fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Base {
  5. void foo(int);
  6. };
  7.  
  8. struct Derived : Base {
  9. using Base::foo;
  10. void foo() { cout << "Derived::foo()\n"; }
  11. };
  12.  
  13. void Derived::foo(int) {
  14. cout << "Derived::foo(int)\n";
  15. }
  16.  
  17. int main() {
  18. Base b;
  19. b.foo(2);
  20. Derived d;
  21. d.foo(2);
  22. d.foo();
  23. return 0;
  24. }
  25.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:13:6: error: prototype for ‘void Derived::foo(int)’ does not match any in class ‘Derived’
 void Derived::foo(int) {
      ^
prog.cpp:5:8: error: candidates are: void Base::foo(int)
   void foo(int);
        ^
prog.cpp:10:8: error:                 void Derived::foo()
   void foo() { cout << "Derived::foo()\n"; }
        ^
stdout
Standard output is empty