fork download
  1. struct A
  2. {
  3. void foo() { };
  4. };
  5.  
  6. struct B
  7. {
  8. private:
  9. void foo() { };
  10. };
  11.  
  12. struct C : public A, public B { };
  13.  
  14. int main()
  15. {
  16. C c;
  17. c.foo();
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:17:6: error: request for member 'foo' is ambiguous
prog.cpp:9:9: error: candidates are: void B::foo()
prog.cpp:3:9: error:                 void A::foo()
stdout
Standard output is empty