What's the correct way of creating an instance of class in D?

Adam D Ruppe destructionator at gmail.com
Thu Nov 3 15:59:17 UTC 2022


On Thursday, 3 November 2022 at 15:40:02 UTC, H. S. Teoh wrote:
> D does not have the equivalent of C++'s allocating a class 
> instance on the stack.  In D, all class instances are allocated 
> on the heap and class variables are references to them.

well there is

scope Object o = new Object;

which is stack allocated but still a reference of course



More information about the Digitalmars-d-learn mailing list