dsimcha <[email protected]> wrote:

I've just found a new D-specific design pattern for simulating non-virtual multiple inheritance by abusing inner classes and alias this. Here's an example:

class Foo {
    uint num = 2;
}

class Bar {
    uint num = 3;
}

class Outer : Foo {

    class Inner : Bar {}

    Inner inner;

    this() {
        inner = new Inner;
    }

    alias inner this;
}

I believe this is mentioned in TDPL.

--
Simen

Reply via email to