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)


Reply via email to