On Fri, Aug 7, 2009 at 1:20 PM, Aaron Watters<[email protected]> wrote: > Hi guys. D looks cool. A couple of things confuse me. > The first is: what happens if I do a > > delete cl; > > after storing a reference to cl somewhere? Can I use the stored > reference? Is it invalid? Please elucidate, thanks.
If you delete something and attempt to use another reference to the deleted object, the behavior's undefined. Basically the same thing as accessing a dangling pointer in C or C++. 'delete' is really just there for when you *know* that there are no other references and you want to ensure that it gets cleaned up immediately.
