fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<typename T>
  5. class Test
  6. {
  7. T value;
  8. public:
  9. Test(T value);
  10.  
  11. void print() { cout << value; }
  12. };
  13.  
  14. template<>
  15. Test<float>::Test(float value) { this->value = value; }
  16.  
  17. int main() {
  18.  
  19. Test<float> t(1.0f);
  20. t.print();
  21.  
  22.  
  23. Test<float> * s = new Test<float>(1.0f);
  24. s->print();
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
11