ambiguity access of memberfunctions in C++?
class base1
{
public:
void display()
{
cout<<"Base1"<<endl;
}
};
class base2
{public:
void displ开发者_如何学Goay()
{
cout<<"Base2"<<endl;
}};
class derived :public base1, public base2
{
};
Can anyone explain how to call base::display() through derived class object.
I believe you would do this:
this->base1::display(); // call the display() method as defined in base1
this->base2::display(); // call the display() method as defined in base2
derived d;
d.base1::display();
精彩评论