digitalmars.D - How to use mixin import code outside the class definition.
- Brian (17/17) Jan 09 2017 mixin template Bar()
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?
Jan 09 2017