Overcoming diamond ambiguity in different way
问题 I know the diamond problem and method to solve it using virtual base class. I tried to solve diamond problem in a different way but did not succeed. I don't know why. #include <iostream> using namespace std; class A { public: void display() { cout << "successfully printed"; } }; class B: public A { }; class C: private A // display() of A will become private member of C { }; class D: public B, public C // private member display() of C should not be inherited { }; int main() { D d; d.display();