fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct S
  5. {
  6. S() { cout << "S()\n"; }
  7. ~S() { cout << "~S()\n"; }
  8.  
  9. void release()
  10. {
  11. cout << "release() \\\n";
  12. delete this;
  13. cout << "release() /\n";
  14. }
  15. };
  16.  
  17. int main()
  18. {
  19. S* s = new S();
  20. s->release();
  21. }
Success #stdin #stdout 0s 4292KB
stdin
Standard input is empty
stdout
S()
release() \
~S()
release() /