Simulating Multiple Inheritance

Simen kjaeraas simen.kjaras at gmail.com
Thu Oct 28 15:02:54 PDT 2010


Jimmy Cao <jcao219 at gmail.com> wrote:

> Well, you can't have multiple alias this's right?
>
> So then, wouldn't it still only limit to 2 base classes?

It is extensible like this:

class Outer : Foo {
     class Inner : Bar {
         class InnerInner : Baz {
         }

         InnerInner innerInner;
		
         this() {
             innerInner = new InnerInner;
         }
		
         alias innerInner this;
     }

     Inner inner;

     this() {
         inner = new Inner;
     }

     alias inner this;
}

It should be possible to turn this into a mixin.


-- 
Simen


More information about the Digitalmars-d mailing list