Delay allocating class instance in stack.

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 21 23:49:32 PDT 2017


On 03/21/2017 11:47 PM, Ali Çehreli wrote:

 >     method(false);
 >     method(true);
 > }
 >
 > Gotta love D for allowing such code but it comes with surprises. Why do
 > we suddenly get two destructor calls?
 >
 > ~this
 > ~this

Answering own question: There are two destructor calls because I call 
method() twice.

Ali



More information about the Digitalmars-d-learn mailing list