Classes and Structs, Memory management questions

Andrea Fontana via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 2 03:26:00 PDT 2016


On Friday, 2 September 2016 at 08:43:45 UTC, dom wrote:
> from what i got Classes are always reference types and structs 
> are value types in D. i am wondering why that is. for me the 
> main difference between classes and structs is not how they are 
> allocated, but that one has inhertiance, and the other hasn't.

It depends by language you're using. In C++, for example you can 
inherit both! The only difference AFAIK is that c++ structs has 
public default inheritance vs private for classes.

Andrea


More information about the Digitalmars-d-learn mailing list