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 setiosflags c++?
What is data structure in c++?
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?
Explain the static storage classes in c++.
Evaluate as true or false: !(1 &&0 || !1) a) True b) False c) Invalid statement
How do you find out if a linked-list has an end?
What is abstraction in c++ with example?
What are the benefits of pointers?
what does the following statement mean? int (*a)[4]
What is the oldest programming language?
What is the maximum combined length of command line arguments including the space between adjacent arguments?
If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?
Do you know the problem with overriding functions?
How is computer programming useful in real life?
What is setw manipulator in c++?