mixin template Bar()
{
override void func() { writeln("Bar.func()"); }
}
class Foo
{
void func() { writeln("Foo.func()"); }
}
void test()
{
Foo b = new Foo();
b.func(); // calls Foo.func()
b = new Foo();
mixin(b, Bar());
b.func(); // calls Bar.func()
}
It's crazy idea?