Multiple class inheritance

Steven Schveighoffer schveiguy at yahoo.com
Tue Feb 5 09:09:26 PST 2008


"Heinz" wrote
> Hi,
>
> Is it posible to do multiple class inheritance in D?
>
> Example:
>
> class A
> {
>
> }
>
> class B
> {
>
> }
>
> class C : A, B
> {
>
> }
>
> Am i dreaming or it can be done?

It sort of can be simulated with inner classes I think:

class A
{
}

class B
{
}

class C : A
{
   B getB() { return new InnerClass(); }
   private class InnerClass : B
   {
       // can override B functions, can access C members.
   }
}

-Steve 




More information about the Digitalmars-d-learn mailing list