Strange destructors' call order

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 30 14:22:57 PDT 2016


On Friday, 30 September 2016 at 21:18:46 UTC, unDEFER wrote:
> So destructors of child objects called earlier than destructor 
> of the parent object.

Since you are letting the garbage collector clean up those 
classes, it is free to call the destructors in whatever order it 
deems convenient, since all the objects, parents and children, 
are considered dead simultaneously.

If you need destructor ordering, use structs or explicit create 
and destroy calls.



More information about the Digitalmars-d mailing list