Struct Inheritence

Yuxuan Shui via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 19 14:08:57 PST 2016


On Friday, 19 February 2016 at 21:58:24 UTC, user001 wrote:
> Well struct don't have it, but i would like something like it 
> but only for data, i don't need functions or anything like that 
> just data.
>
> [...]

How about

struct A
{
     int valueA;
}

struct B
{
     A a;
     int valueB;
     alias a this;
}

struct C
{
     B b;
     int valueC;
     alias b this;
}

?


More information about the Digitalmars-d-learn mailing list