fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. class Directory{
  6.  
  7. string name;
  8. public:
  9. Directory(string name = string()):name(name) {
  10.  
  11. }
  12. ~Directory() {
  13. cout << "Deleting was called" <<endl;
  14.  
  15. }
  16.  
  17. Directory& operator=(Directory& other){
  18. cout << "cp assigment" <<endl;
  19. return *this;
  20. }
  21. Directory& operator=(Directory&& other){
  22. cout << "move assigment" <<endl;
  23. return *this;
  24. }
  25. };
  26.  
  27. int main() {
  28. //Directory dir = Directory("alex");
  29. Directory dir("alex");
  30. Directory dir2;
  31. dir2 = dir;
  32.  
  33. cout<<"done"<<endl;
  34. return 0;
  35. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
cp assigment
done
Deleting was called
Deleting was called