fork(10) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <typename T> class tt
  5. {
  6. public :
  7. tt()
  8. {
  9. std::cout << std::endl << " CONSTRUCTOR" << std::endl;
  10. }
  11. template <typename U> const tt<T>& operator=(const tt<U>& that){std::cout << std::endl << " OPERATOR" << std::endl;}
  12. template <typename U> tt(const tt<U>& that)
  13. {
  14. std::cout << std::endl << " COPY CONSTRUCTOR" << std::endl;
  15. }
  16. };
  17.  
  18.  
  19. tt<int> test(void)
  20. {
  21. std::cout << std::endl << " INSIDE " << std::endl; tt<int> a; return a;
  22. }
  23.  
  24. int main() {
  25. // your code goes here
  26. tt<int> a ; a = test();
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
   CONSTRUCTOR

      INSIDE 

   CONSTRUCTOR