Simulating multiple inheritance

bls bizprac at orange.fr
Sun Apr 1 09:19:12 PDT 2012


On 03/31/2012 10:05 AM, Andrej Mitrovic wrote:
> One issue with the new wxWidgets 2.9.x series is that there seem to be
> more multiply-inherited classes than before

A bit more complete snippet.

interface Foo
{
     void doFoo();
}
// Foo implementation
mixin template FooMixin()
{
     alias typeof(this) thisClass;

     void doFoo()
     {
         thisClass.init();
     }
}

class Bar
{
     void doFoo() {}
}

class Baz :Bar, Foo
{
     alias Bar.doFoo BarFoo;

     mixin FooMixin;

     void init() {}

}

hth


More information about the Digitalmars-d-learn mailing list