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(const Hello& other)
  14. {
  15. printf("copy CTOR\n");
  16. }
  17.  
  18. Hello& operator=(Hello& h)
  19. {
  20. printf("assignment\n");
  21. return *this;
  22. }
  23. };
  24.  
  25. int main() {
  26.  
  27. printf("first:\n");
  28. Hello firstHello(3);
  29.  
  30. printf("\nsecond:\n");
  31. Hello secondHello = Hello(4);
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
first:
CTOR

second:
CTOR