import tango.io.Stdout;

interface A {
    void f();
}

interface B {
    void g();
}

template A_impl() {
    int a = 1;
    void f() {
        Stdout("Inside f() and my data is: ")(a).newline;
    }
}

template B_impl() {
    mixin A_impl;
    int b = 2;
    void g() {
        Stdout("Inside g() and my data is: ")(b).newline;
    }
}

class A_and_B : A, B {
    mixin B_impl;
    
    int sum() {
        return a + b;
    }
}

int main() {
    auto ab = new A_and_B();
    ab.f();
    ab.g();
    Stdout("Sum is: ")(ab.sum()).newline;
    return 0;
}