I'm just reading this stuff totally spelled out in Effective C++ second edition. Check out Item 43: Use multiple inheritance judiciously.
Printable View
I'm just reading this stuff totally spelled out in Effective C++ second edition. Check out Item 43: Use multiple inheritance judiciously.
Fordy, thanks. What you're saying is that you can't just call fb.Sing(); because the compiler doesn't know which to call? That solves that I suppose.
side: TK, if you're not an OOP guy, why do you keep responding on clearly OOP topics and then validating it with "... but then I'm not an OOP guy"
Yup...that's how I see it.....Quote:
Originally posted by FillYourBrain
Fordy, thanks. What you're saying is that you can't just call fb.Sing(); because the compiler doesn't know which to call? That solves that I suppose.
Try using a scope identifier:
Derived Obj;
Obj.Base1::func(...);
What is this? Are you telling me that you can't put 1 and 1 together? lol.
read my initial question. it deals with how the compiler resolves ambiguity. It's NOT asking for a way around the ambiguity. damn you're dense.
No but honestly check out Item 43 in Effective C++ second edition. It gives a long description. I ofcourse didn't see this until after I answered the question correctly.
I'm not a C++er. I'm a Cer.
Heres an example I was given in my lectures. Its a complex issue but this gives you an idea how to avoid multiple copies being inherited.
Now GrandMa is termed a virtual base class. I'm not sure which copy is inherited, like I say its a complex issue which can usually be avoided. Hope that helps though :)Code:class GrandMa
{
protected:
int value;
};
class Son : virtual public GrandMa
{
Son( )
};
class Daughter : virtual public GrandMa
{
Daughter( )
};
class GrandChild : public Son, public Daughter
{
GrandChild( ); //now only has 1 copy of value
}