fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <typename T1, typename T2>
  5. struct S
  6. {
  7. T1 x;
  8. T2 y;
  9. template <typename T3, typename T4>
  10. S (const S <T3, T4> other) {x = other.x; y = other.y;}
  11. S (T1 new_x, T2 new_y) {x = new_x; y = new_y;}
  12. void print (void) {cout << x << " " << y << endl;}
  13. };
  14.  
  15. int main (void)
  16. {
  17. S <int, int> s = S <double, double> (1.2, 3.4);
  18. s.print ();
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
1 3