C++ examples for Class:Inheritance
Demonstrate ambiguity in multiple inheritance
#include <iostream> using namespace std; class A// w w w . ja v a2s. c om { public: void show() { cout << "Class A\n"; } }; class B { public: void show() { cout << "Class B\n"; } }; class C : public A, public B { }; int main() { C objC; //object of class C // objC.show(); //ambiguous--will not compile objC.A::show(); //OK objC.B::show(); //OK return 0; }