2011-07-25 5 views
0
class base1 
{ 
public: 
void display() 
{ 
    cout<<"Base1"<<endl; 
} 
}; 
class base2 
{public: 
void display() 
{ 
    cout<<"Base2"<<endl; 
}}; 
class derived :public base1, public base2 
{ 
}; 

誰でも、派生クラスオブジェクトを通じてbase :: display()を呼び出す方法を説明できます。C++でのメンバー関数のあいまいなアクセス?

答えて

0

私はあなたがこれを行うだろうと信じて:

this->base1::display(); // call the display() method as defined in base1 

this->base2::display(); // call the display() method as defined in base2 
+0

私は派生Dを呼び出すしようとしていたとき、私はerrprを取得しています。 d.display()。 – Ramesh

0
derived d; 
d.base1::display(); 
関連する問題