Re: Static method of inner class needs this

2015-02-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/9/15 4:30 AM, ketmar wrote: On Mon, 09 Feb 2015 07:32:32 +, rumbu wrote: class Outer { class Inner { static Inner createInner() { return new Inner(); //need 'this' to access member this } } } Is this a bug? strictly speaking, t

Re: Static method of inner class needs this

2015-02-09 Thread rumbu via Digitalmars-d-learn
On Monday, 9 February 2015 at 09:30:55 UTC, ketmar wrote: ... you can use `static class Inner` to tell the compiler that `Inner` doesn't require any context. Thank you, static qualifier works. I thought in C# terms where a static class means anything else.

Re: Static method of inner class needs this

2015-02-09 Thread ketmar via Digitalmars-d-learn
On Mon, 09 Feb 2015 07:32:32 +, 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. com

Re: Static method of inner class needs this

2015-02-09 Thread wobbles via Digitalmars-d-learn
On Monday, 9 February 2015 at 07:32:33 UTC, rumbu wrote: class Outer { class Inner { static Inner createInner() { return new Inner(); //need 'this' to access member this } } } Is this a bug? If Inner is not nested, it works as expected: class I

Static method of inner class needs this

2015-02-08 Thread rumbu via Digitalmars-d-learn
class Outer { class Inner { static Inner createInner() { return new Inner(); //need 'this' to access member this } } } Is this a bug? If Inner is not nested, it works as expected: class Inner { static Inner createInner() { return