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 do you mean by friend class & friend function in c++?
Is it legal in c++ to overload operator++ so that it decrements a value in your class?
What is #include iomanip?
How long will it take to learn programming?
What is binary search in c++?
What is copy constructor? Can we make copy constructor private in c++?
What language does google use?
Function can be overloaded based on the parameter which is a value or a reference. Explain if the statement is true.
Explain the operation of overloading of an assignment operator.
Write about the use of the virtual destructor?
Do we have to use initialization list in spite of the assignment in constructors?
What is the most useful programming language?
What is std :: flush?
I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?
What is const in c++?