Converting multiple inheritance code into C ++ for D language
biozic via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Feb 18 01:33:25 PST 2017
On Friday, 17 February 2017 at 23:35:33 UTC, Jean Cesar wrote:
> On Friday, 17 February 2017 at 23:31:41 UTC, Adam D. Ruppe
> wrote:
>> On Friday, 17 February 2017 at 23:11:25 UTC, Jean Cesar wrote:
>>> so I changed the code to use interface but how would I do so
>>> I could use the constructor in the same way as such a C ++
>>> code?
>>
>> Interfaces + mixin templates give you something very similar
>> to multiple inheritance. You can have named functions in the
>> mixin templates that do the work of the constructor, then call
>> them from the real constructor.
>
>
> Yes I saw here that it uses interface to make multiple
> inheritance just like C#, but I did not understand what would
> this mixing?
A mixin can be used to provide an base implementation for the
methods of an interface, along with data members, so that you
don't have to define it in every class that implements the
interface.
An example : https://dpaste.dzfl.pl/b656851e5c51
More information about the Digitalmars-d-learn
mailing list