fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. template <typename T>
  7. string f(const T& var)
  8. {
  9. return "sam durak";
  10. }
  11.  
  12. template <typename T>
  13. T square(T v) { return v*v; }
  14.  
  15. int f(int v)
  16. {
  17. cout << "int" << endl;
  18. return square(v);
  19. }
  20.  
  21. double f(double v)
  22. {
  23. cout << "double" << endl;
  24. return square(v);
  25. }
  26.  
  27. class Shit
  28. {
  29.  
  30. };
  31.  
  32. int main()
  33. {
  34.  
  35. cout << f(4) << endl;
  36. cout << f(5.7) << endl;
  37.  
  38. Shit s;
  39. cout << f(s) << endl;
  40.  
  41. return 0;
  42. }
  43.  
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
int
16
double
32.49
sam durak