Randal L. Schwartz wrote: >>>>>> "David" == David Iberri <[EMAIL PROTECTED]> writes: > > David> Can anyone point me to some docs relevant to multiple inheritance? > > David> I have two base classes A and B, then a derived class C that > David> inherits from A and B. Pretty standard, I think: > > No. Not pretty standard. Extremely unusual, and as you see, got you > into trouble. You probably want "has-a" relationships here, not > "is-a". Make C contain an object of type A and an object of type B, > then delegate calls to the appropriate object. I think > Class::Delegate can help here.
Thanks Randal, and thanks Chris: both solutions (Class::Delegate and NEXT.pm) bandaged things up. > I can't see how C "is" an A, and "is" a B, especially if they have > distinct data members. How could C understand and apply every method > defined for an A? What if both A and B define a "foo" method? Which > one (or both?) should be called? > > If the answer is "multiple inheritance", you probably asked the > wrong question. Back up a step, and take a different tack. As it turns out, multiple inheritance wasn't the correct answer. "Multilevel inheritance" (for lack of a better title) did the trick, though: C inherits from B, B inherits from A, and everybody's happy. Thanks for urging me to reconsider my approach. Regards, David