fork download
  1. #include <iostream>
  2. #include <cstdio>
  3.  
  4. using namespace std;
  5.  
  6. class Hello{
  7. public:
  8. Hello(int n)
  9. {
  10. printf("CTOR\n");
  11. }
  12.  
  13. Hello& operator=(Hello& h)
  14. {
  15. printf("assignment\n");
  16. return *this;
  17. }
  18. };
  19.  
  20. int main() {
  21.  
  22. printf("first:\n");
  23. Hello firstHello(3);
  24.  
  25. printf("\nsecond:\n");
  26. Hello secondHello = Hello(4);
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
first:
CTOR

second:
CTOR