fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Yoba
  5. {
  6. public:
  7. Yoba()
  8. {
  9.  
  10. }
  11.  
  12. ~Yoba()
  13. {
  14. std::cout << "Destructed: " << this << std::endl;
  15. }
  16.  
  17. Yoba * method()
  18. {
  19. Yoba * ref = new Yoba();
  20. return ref;
  21. }
  22.  
  23. void show()
  24. {
  25. std::cout << "123" << std::endl;
  26. }
  27.  
  28. };
  29.  
  30. int main() {
  31. // your code goes here
  32. Yoba y;
  33. Yoba * r = y.method();
  34. r->show();
  35. delete r;
  36. r->show();
  37. return 0;
  38. }
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
123
Destructed: 0x8069008
123
Destructed: 0xbfbc56af