fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Test;
  5.  
  6. class Int
  7. {
  8. public:
  9. operator Test();
  10. };
  11.  
  12. class Test
  13. {
  14. public:
  15. Test() {}
  16. //Test(const Int&) { cout << "Test(const Int&)" << endl; }
  17. };
  18.  
  19. Int::operator Test()
  20. {
  21. cout << "Int::operator Test()" << endl;
  22. return Test{};
  23. }
  24.  
  25. int main()
  26. {
  27.  
  28. Int i;
  29.  
  30. Test t1 = Test(i);
  31. Test t2 = (Test)i;
  32.  
  33. }
  34.  
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Int::operator Test()
Int::operator Test()