GC Destruction Order
bitwise via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue May 19 11:15:05 PDT 2015
In C#, it's possible that class members can actually be destroyed before
the containing object.
Example:
class Stuff
{
Class1 thing1;
Class2 thing2;
~Stuff() {
thing1.DoSomeFinalization(); // [1]
}
}
I forget what the exact behavior was, but basically, [1] is unsafe because
it may have already been destructed/freed by the time ~Stuff() is called.
Is this also true for D?
Bit
More information about the Digitalmars-d-learn
mailing list