Why are structs and classes so different?
IGotD-
nise at nise.com
Mon May 16 17:02:57 UTC 2022
On Sunday, 15 May 2022 at 16:08:01 UTC, Mike Parker wrote:
>
> `scope` in a class variable declaration will cause it to the
> class to be allocated on the stack.
>
Common practice is that a class has class members itself. So
where are they allocated? Most likely is only the top class that
is on the stack, the class members are allocated on the heap
because the constructor is already compiled.
That scope isn't that useful unless you have it like C++, that
expands class members in the parent class.
More information about the Digitalmars-d-learn
mailing list