fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5.  
  6. class Base {};
  7. class Derived : public Base {};
  8.  
  9. template<typename T>
  10. void doSomething(T t) { cout << "Type!" << endl; }
  11.  
  12. template<>
  13. void doSomething(Base b) { cout << "Base!" << endl; }
  14.  
  15.  
  16.  
  17. int main() {
  18. Base b;
  19. doSomething(b);
  20.  
  21. Derived d;
  22. doSomething(d);
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Base!
Type!