fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class X{
  6. public:
  7. int id;
  8. X(int id){
  9. this->id = id;
  10. }
  11. ~X(){
  12. cout << "destroying " << id << endl;
  13. }
  14.  
  15. };
  16.  
  17.  
  18.  
  19. int main(){
  20.  
  21.  
  22. X a(1);
  23. a = X(2);
  24.  
  25.  
  26. return 0;
  27.  
  28. }
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
destroying 2
destroying 2