fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. class CBar {
  4. public:
  5. CBar(int n) {cout << "make " << n << endl;}
  6. CBar(const CBar& other) {cout << "copy" << endl;}
  7. CBar& operator=(const CBar& other) {cout << "assign" << endl; return *this;}
  8. };
  9.  
  10. int main(void) {
  11. CBar a(10);
  12. cout << "-----" << endl;
  13. a = CBar(15);
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
make 10
-----
make 15
assign