Without multiples inheritance, how is this done?

matheus matheus at gmail.com
Sat May 8 19:30:26 UTC 2021


On Saturday, 8 May 2021 at 18:33:35 UTC, Jack wrote:
> ...
> but the class ExtendFoo and ExtendedBaa  must inherit from Foo 
> and Baa, respectively. But how can I make it inherit the 
> routines from DRY class too without multiples inheritance? in 
> C++ I'd just do:
>
> class ExtendedFoo : DRY, Base { /* ... */ }
> class ExtendBaa : DRY, Base { /* ... */ }

What about this model:

class baseFoo{
    // Implement foo stuff
}

class baseFooBar : baseFoo{
    // Implement bar stuff
}

class FooBar : baseFooBar{
    // Do your FooBar thing!
}

Matheus.


More information about the Digitalmars-d-learn mailing list