<div dir="ltr"><div>Greetings</div><div><br></div><div>I have a question on class destructor method. D documentation for destructors says:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">"The garbage collector is not guaranteed to run the destructor for all unreferenced objects. Furthermore, the order in which the garbage collector calls destructors for unreference objects is not specified. This means that when the garbage collector calls a destructor for an object of a class that has members that are references to garbage collected objects, those references may no longer be valid. This means that destructors cannot reference sub objects."<br>
<br><br></blockquote>Now I have a class A and it refers to subobject B. But B may or may not have other objects referring to it. As a result, an object of A is GCed, but subobject B may or may not be getting garbage collected.<div>
<br></div><div>In this scenario, am I allowed to make a reference to subobject B from the destructor of A? Is there a way to find out if B is garbage collected or not?</div><div><br></div><div>Regards</div><div>- Puneet</div>
<div><br></div></div>