fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Base {
  5. public:
  6. Base(){
  7. cout<<"create Base "<<this<<endl;
  8. }
  9. Base(const Base& a){
  10. cout<<"create copy Base "<<this<<" "<<&a<<endl;
  11. }
  12. /* Base(Base&& a)
  13. {
  14.   cout<<"create move Base "<<this<<" "<<&a<<endl;
  15.   }*/
  16. ~Base() {
  17. cout<<"deleting Base "<<this<<endl;
  18. }
  19.  
  20. Base & operator = (const Base &a)
  21. {
  22. cout<<"operator "<<this<<" "<<&a<<endl;
  23. return *this;
  24. }
  25.  
  26.  
  27. };
  28.  
  29. Base func (Base x)
  30. {
  31. cout<<"*********************"<<endl;
  32.  
  33. return x;
  34. }
  35.  
  36. int main()
  37. {
  38.  
  39. Base a;
  40.  
  41.  
  42. Base b;
  43.  
  44. cout<<"!!!!!!!!!!!!!!!!!!!!!!!!!!"<<endl;
  45.  
  46. b = func (a);
  47.  
  48. cout<<"!!!!!!!!!!!!!!!!!!!!!!!!!!"<<endl;
  49.  
  50. return 0;
  51. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
create Base 0xbfa8c3cc
create Base 0xbfa8c3cd
!!!!!!!!!!!!!!!!!!!!!!!!!!
create copy Base 0xbfa8c3ce 0xbfa8c3cc
*********************
create copy Base 0xbfa8c3cf 0xbfa8c3ce
operator 0xbfa8c3cd 0xbfa8c3cf
deleting Base 0xbfa8c3cf
deleting Base 0xbfa8c3ce
!!!!!!!!!!!!!!!!!!!!!!!!!!
deleting Base 0xbfa8c3cd
deleting Base 0xbfa8c3cc