Static method of inner class needs this
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Feb 9 01:30:55 PST 2015
On Mon, 09 Feb 2015 07:32:32 +0000, rumbu wrote:
> class Outer {
> class Inner {
> static Inner createInner()
> {
> return new Inner(); //need 'this' to access member
> this
> }
> }
> }
>
> Is this a bug?
strictly speaking, this is not a bug. compiler doesn't do deep analysis
on nested structures/classes to determine if they really require context
pointer. you can use `static class Inner` to tell the compiler that
`Inner` doesn't require any context.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150209/982873d1/attachment.sig>
More information about the Digitalmars-d-learn
mailing list