fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A { public:
  5. virtual void f(const int i) { cout << "A::f" << endl; }
  6. };
  7. class B : public A { public:
  8. // Hide A's f with new implementations
  9. virtual void f() { cout << "B::f" << endl; }
  10. };
  11. class C : public B { public:
  12. virtual void f() { cout << "C::f" << endl; }
  13. };
  14. int main() {
  15.  
  16. C c;
  17. B* pb = &c;
  18. pb->f();
  19. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
C::f