Multiple Inheritance of Classes

Lars Ivar Igesund larsivar at igesund.net
Tue Aug 12 00:32:06 PDT 2008


Chris R. Miller wrote:

> Understand, I'm NOT demanding ANYTHING.
> 
> What is the current state of thought about Multiple Inheritance for
> classes in D?  I'd like to have that feature, since it'd make some stuff
> I want to do a bit easier.  Is it not there because it's not worth the
> effort to implement?  Because it's evil and needs to die (I don't know,
> some people could possibly be adamantly anti-MI)?  

This is actually the reason, not the adamantly anti-MI part, just that MI is
evil and that is well acknowledged almost everywhere. You will find good
argumentation against it if you look, too.

> I don't know.  I know 
> I can add a lot with mixins, but I'd just like to know what the state of
> the feature is.
> 
> The reason is I was trying to explain how cool D is to some other
> friends of mine, and they asked about Multiple Inheritance (of classes)
> and they were sort of put off by it's lack of it.  Then again, he was an
> Objective-C programmer...  ;-)

In the languages where MI is possible, it usually also is possible to not
shoot your own foot with some care, in which case it can appear as a
powerful feature. But almost everywhere it just is a very bad idea, and you
will find it is banned in many projects for languages allowing it (like
C++).

> So please don't take offense, since none is meant, I just wanted to know
> what I could hope for in the future.

You should hope you can redesign your application to not need MI ;)

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango



More information about the Digitalmars-d mailing list