template-cpp.nut 281 B

1234567891011121314151617181920212223
  1. typedef string_t string;
  2. typedef int_t int;
  3. typedef any_t T;
  4. template<typename T>
  5. string doIt(T x)
  6. {
  7. int z = 3;
  8. z = (int)x;
  9. return x.tostring();
  10. }
  11. class Klass
  12. {
  13. template<typename T>
  14. string doIt(T x)
  15. {
  16. return x.tostring();
  17. }
  18. }
  19. Klass k = new Klass();
  20. print(k.doIt(10));