The Diamond of Death
So, what thoughts do you guys have (if any) about multiple inheritance?
E.G.
BaseClassA {..};
BaseClassB {..};
ClassC : public BaseClassA, public BaseClassB {..};
There are three approaches we could take with this.
1) Disallow it. We stick with single inheritance only. The downside is that this could be quite limiting. We may end up with duplication of code simply because we hit our limit on inheritance.
2) Allow it with restrictions: The restriction would be that only one of the base classes could have it's own base class (in other words, we allow multiple parent classes, but each class can only have at most one (1) grandclass). Less restrictive than option 1, but still a bit restrictive.
3) No restrictions. The downside here is we run into the possibilty of the "Diamond of Death", and have to start dealing with virtual base classes and all that goes along with that (hint: if you don't know what that is, you don't want to know. Pray you never have to deal with it).
I personally am leaning toward option 2, with perhaps limited forays into option 3 (if and only if we are REALLY careful not to double parent any base classes, if ever we have to write "virtual public BaseClassB", we've opened ourselves up to some very nasty cans of worms, and I'd really like to avoid that). But I'm open to any thoughts.
Last edited by RonHiler; 04-02-2010 at 09:20 AM.
"They laughed when I said I was going to be a comedian ... They're not laughing now." - Bob Monkhouse