Answer Posted / mms zubeir
There are two scenarios:
1. Using "delete this;" in destructor
Here the call will be a recursive call to the destructor
infinitely. So the program hangs here.
2. Using "delete this;" in other members of a class
including constructor.
In this case, the call is a sucide call since the object
tries to delete itself which is nothing but sitting in a
space and destroy that space itself. That is definitely a
memory crash.
| Is This Answer Correct ? | 13 Yes | 4 No |
Post New Answer View All Answers
What is the difference between public and private data members?
What are c++ manipulators?
What is flush () in c++?
What is c++ good for?
Explain shallow copy?
What is encapsulation in c++?
Which sort is best for the set: 1 2 3 5 4 a) Quick Sort b) Bubble Sort c) Merge Sort
What is oop in c++?
What is the best book for c++ beginners?
What is a memory leak c++?
Define upcasting.
What is function overloading c++?
What are separators in c++?
What are disadvantages of pointers?
What is protected inheritance?