On Sunday, 3 December 2017 at 07:38:47 UTC, Jonathan M Davis wrote:
On Sunday, December 03, 2017 01:05:00 Nick Sabalausky via Digitalmars-d- learn wrote:
Is this even possible? My attempts:

class Outer {
  struct Inner {
      void foo() {
          // Error: no property 'outer' for type 'Inner'
          Outer o = this.outer;

          // Error: cannot implicitly convert expression
          // this of type Inner to testNested.Outer
          Outer o = this;
      }
  }
}

As I understand it, there is no outer for nested structs, only nested classes. So, you'll either have to use a nested class or explicitly pass a reference to the outer class to the nested struct.

- Jonathan M Davis

It wouldn't make much sense either, if a struct was able to do it.


Reply via email to