What is difference between struct and class?

Rnd r_narang at yahoo.com
Mon Jun 3 03:40:43 UTC 2019


On Monday, 3 June 2019 at 00:47:27 UTC, Adam D. Ruppe wrote:
> On Monday, 3 June 2019 at 00:17:08 UTC, Rnd wrote:
>> What additional features do classes offer in D?
>
> Classes support built-in runtime polymorphism through 
> inheritance. structs don't.
>
> As a result of this, classes are a little bit heavier 
> resource-wise and are semantically always object references.

I am not clear if structs can have constructors (this) and 
whether they can be multiple? Also can data be made private and 
getters and setters used to access them?



More information about the Digitalmars-d-learn mailing list