Multiple Inhertiance?

Justin Whear via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 5 16:50:09 PST 2014


On Thu, 06 Nov 2014 00:39:11 +0000, Patrick Jeeves wrote:

> So what's bothering me is that I can do this:
> 
> class NullType {}
> class Monkey(T) : T {}
> class Zombie(T) : Monkey!T {}
> class Robot(T)  : Monkey!T {}
> class Pirate(T) : Monkey!T {}
> class Ninja(T)  : Monkey!T {}
> 
> class MultipleInheritance : Zombie!(Robot!(Pirate!(Ninja!NullType))) {};
> 
> To get mutliple inheritance.  I just don't understand what the purpose
> of not allowing multiple inheritance is if I can get around it this
> easily, and its far less managable than it would be if it had language
> support.

Short answer: that's not multiple inheritance.  That hierarchy has a 
simple,
well-defined order of method lookup and overriding, so things like the 
diamond
problem are not possible.


More information about the Digitalmars-d mailing list