Template Inherit
Inheritance mixin
template Inherit(PT...)
;
Description
Inserts structs specified by PT type tuple as members and a dispatcher method that statically transfers any method calls and member accesses to corresponding child struct.
Example
struct Foo
{
int x = 100;
int foo() { return 11; }
}
struct Bar
{
int y = 99;
int bar() { return 22; }
}
struct TestObj
{
mixin Inherit!(Foo, Bar);
}
TestObj obj;
obj .x *= 2;
obj .y = 10;
assert(obj .x == 200);
assert(obj .y == 10);
assert(obj .foo() == 11);
assert(obj .bar() == 22);