Distinct "static" parent property contents for children
Timoses
timosesu at gmail.com
Wed Nov 8 17:40:57 UTC 2017
On Wednesday, 8 November 2017 at 17:38:27 UTC, Timoses wrote:
> Option 2:
> class Base { int x;}
> class A : Base
> {
> this() { x = 1; }
> }
> class B : Base
> {
> this() { x = 2; }
> }
>
> Con: Well, the downside is that every instance of A and B
> allocates space for x although only one allocation would be
> required..
To elaborate: Every instance of A or B would allocate x PER
instance of A or B (where one allocation for A or B would suffice)
More information about the Digitalmars-d-learn
mailing list