What is difference between struct and class?

Mike Parker aldacron at gmail.com
Mon Jun 3 08:50:46 UTC 2019


On Monday, 3 June 2019 at 08:47:41 UTC, Mike Parker wrote:

>>
>> If yes, when should one use 'new'?
>
> Whenever you need to allocate something from the GC heap. In my 
> experience, it's rare to need it with value types in D. I tend 
> to use it primarily with classes and arrays.

Ali's book has an example using a struct-based linked list in the 
chapter on pointers:

https://forum.dlang.org/thread/rkmcvxftykhsvxofpdtk@forum.dlang.org


More information about the Digitalmars-d-learn mailing list