call to super trashes pointer?

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 23 01:16:08 PST 2016


struct A
{
int blah;
}
class B
{
     A* a;
     this(A* _a)
     {
         writeln(_a)
         a =_a;
     }
}

class C : B
{
     this(A* _a)
     {
         writeln(_a)
         super(_a);
     }
}
int main(string[] args)
{
         A a;
         writeln(&a);
         C c = new C(&a);
}

prints
7FFF56E787F8
7FFF56E787F8
null

??? What is happening here?


More information about the Digitalmars-d-learn mailing list