fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class A{
  6. public:
  7. int f(int x){
  8. cout << x << " " << endl;
  9. }
  10. };
  11.  
  12. class B : public A{
  13. public:
  14. int f(int y){
  15. A :: f(y+1);
  16. }
  17. };
  18.  
  19. void g(A a, B b){
  20. a.f(3), b.f(3);
  21. }
  22.  
  23. int main(){
  24. B p;
  25. B q;
  26. g(p,q);
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
3 
4