Inner struct accessing host member

Philippe Sigaud via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 5 13:32:07 PDT 2014


I'd have thought that this would work:

struct A
{
     int[] i;
     B b;

     struct B
     {
         void foo() { i ~= 1;}
     }
}

void main()
{
     A a;
     a.b.foo();
}

But the compiler tells me 'need this for i of type int[]'.
Is there any way I can gain access on i inside B?


More information about the Digitalmars-d-learn mailing list