fork download
  1. #include <iostream>
  2.  
  3. void foo()
  4. {
  5. std::cout << "global foo()" << std::endl;
  6. }
  7.  
  8. struct A {
  9. void foo()
  10. {
  11. std::cout << "A::foo()" << std::endl;
  12. }
  13. };
  14.  
  15. struct B : public A {
  16. void call()
  17. {
  18. foo();
  19. }
  20. };
  21.  
  22. int main(int argc, char **argv )
  23. {
  24. B b;
  25. b.call();
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
A::foo()