Simulating Multiple Inheritance
Simen kjaeraas
simen.kjaras at gmail.com
Thu Oct 28 10:04:18 PDT 2010
dsimcha <dsimcha at yahoo.com> 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
More information about the Digitalmars-d
mailing list