Without multiples inheritance, how is this done?

Adam D. Ruppe destructionator at gmail.com
Sat May 8 19:31:34 UTC 2021


On Saturday, 8 May 2021 at 18:33:35 UTC, Jack wrote:
> ```d
> abstract class DRY : Base
> {
>     this(int n)
>     {
>         this.n = n;
>     }
>
>     override int f()
>     {
>         super.doSomething();
>         return n;
>     }
>
>     private int n;
> }
> ```

You can change that from abstract class to `mixin template`, make 
Foo and Baa be `interface`, then use `mixin DRY;` inside your 
child class.



More information about the Digitalmars-d-learn mailing list