C++ Multiple Inheritance Question
- by John
The scenario generating this is quite complex so I'll strip out a few pieces and give an accurate representation of the classes involved.
/* This is inherited using SI by many classes, as normal */
class IBase
{
virtual string toString()=0;
};
/* Base2 can't inherit IBase due to other methods on IBase which aren't appropriate */
class Base2
{
string toString()
{
...
}
};
/* a special class, is this valid? */
class Class1 : public IBase, public Base2
{
};
So, is this valid? Will there be conflicts on the toString? Or can Class1 use Base2::toString to satisfy IBase?
Like I say there are lots of other things not shown, so suggestions for major design changes on this example are probably not that helpful... though any general suggestions/advice are welcome.