D vs C++ classes?
12345swordy
alexanderheistermann at gmail.com
Mon Jun 28 21:50:53 UTC 2021
On Monday, 28 June 2021 at 21:03:21 UTC, Ola Fosheim Grøstad
wrote:
> On Monday, 28 June 2021 at 20:35:25 UTC, solidstate1991 wrote:
>> Multiple inheritance induces a lot of headaches (added
>> complexity, diamond inheritance, etc.), and even C++ devs try
>> to avoid it at all costs. It rarely has any real-life use,
>> that couldn't be solved with interfaces and mixins.
>
> That isn't the point (if it is true). And actually, C++ stdlib
> uses it. Some C++ devs avoid virtual in general though, but
> that is another issue.
>
> The point is that you need multiple inheritance to unify D
> classes with C++ classes, but you don't have to use it if you
> don' want to, so there is no cost to having it. So basically
> only one big benefit, and no real disadvantages.
We *Technically* have multiple inheritance in d via alias this,
so that cat is out of the bag. I just wish walter would bite the
bullet and implemented multiple inheritance properly, so that we
could deprecate alias this as it is a redundant feature.
- Alex
More information about the Digitalmars-d
mailing list