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 C {
  16.  
  17. };
  18.  
  19. template <typename T>
  20. struct B : public T {
  21. void call()
  22. {
  23. T::foo();
  24. }
  25. };
  26.  
  27. int main(int argc, char **argv )
  28. {
  29. B<A> a;
  30. a.call();
  31.  
  32. B<A> c;
  33. c.call();
  34. return 0;
  35. }
  36.  
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
A::foo()
A::foo()