fork download
  1. #include <iostream>
  2.  
  3. class Foo {
  4. public:
  5. Foo() {
  6. std::cout << "ctor" << std::endl;
  7. }
  8.  
  9. Foo(Foo& f) {
  10. std::cout << "copy ctor" << std::endl;
  11. }
  12.  
  13. Foo& operator=(Foo& f) {
  14. std::cout << '=' << std::endl;
  15. }
  16. };
  17.  
  18. int main() {
  19. Foo a;
  20. Foo b = a;
  21.  
  22. Foo c;
  23. Foo d;
  24. c = d;
  25. return 0;
  26. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
ctor
copy ctor
ctor
ctor
=