fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class C1 {
  6. public:
  7. void f() { cout << "something" <<endl; }
  8. };
  9.  
  10. class C2 : public C1 {
  11. };
  12.  
  13. class C3 : public C2 {
  14. public:
  15. void f() override { cout << "something else" <<endl; }
  16.  
  17. };
  18.  
  19. int main() {
  20. C1 c1;
  21. C3 c3;
  22. c1.f();
  23. c3.f();
  24. return 0;
  25. }
Compilation error #stdin compilation error #stdout 0s 3096KB
stdin
Standard input is empty
compilation info
prog.cpp:15:10: error: 'void C3::f()' marked override, but does not override
     void f() override { cout << "something else" <<endl; }
          ^
stdout
Standard output is empty