fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Base1
  5. {
  6. void Foo(double param)
  7. {
  8. cout << "Base1::Foo(double)" << endl;
  9. }
  10. };
  11.  
  12. struct Base2
  13. {
  14. void Foo(int param)
  15. {
  16. cout << "Base2::Foo(int)" << endl;
  17. }
  18. };
  19.  
  20. struct Derived : public Base1, public Base2
  21. {
  22. };
  23.  
  24. int main(int argc, char **argv)
  25. {
  26. Derived d;
  27. d.Foo(1.2);
  28. return 1;
  29. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main(int, char**)’:
prog.cpp:27:7: error: request for member ‘Foo’ is ambiguous
prog.cpp:14:10: error: candidates are: void Base2::Foo(int)
prog.cpp:6:10: error:                 void Base1::Foo(double)
stdout
Standard output is empty