fork download
  1. #include <iostream>
  2.  
  3. class C1 {};
  4. class C2 {};
  5.  
  6. void handleSpecial(C1& c1)
  7. {
  8. std::cout << "Handling C1\n";
  9. }
  10. void handleSpecial(C2& c2)
  11. {
  12. std::cout << "Handling C2\n";
  13. }
  14.  
  15. template <typename T> void handle(T& content)
  16. {
  17. std::cout << "Doing generell stuff\n";
  18. handleSpecial(content);
  19. }
  20.  
  21. int main(int argc, char* argv[])
  22. {
  23. C1 c1;
  24. handle(c1);
  25. C2 c2;
  26. handle(c2);
  27. }
  28.  
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Doing generell stuff
Handling C1
Doing generell stuff
Handling C2