fork download
  1. #include <iostream>
  2.  
  3. class Base { };
  4. class AnotherBase { };
  5.  
  6. class Derv : public Base{ };
  7.  
  8. class Derv2 : public Base { };
  9.  
  10. class DervDerv : public Derv { };
  11.  
  12. void f(const Base &b)
  13. {
  14. printf("b(Base)\n");
  15. }
  16.  
  17. void f(const Derv &b)
  18. {
  19. printf("b(Derv)\n");
  20. }
  21.  
  22. template<class T> void f(const T& t)
  23. {
  24. printf("b(template)\n");
  25. }
  26.  
  27. int main() {
  28. f(Base());
  29. f(AnotherBase());
  30. f(Derv());
  31. f(Derv2());
  32. f(DervDerv());
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
b(Base)
b(template)
b(Derv)
b(template)
b(template)