Answer Posted / hemant
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 ? | 4 Yes | 2 No |
Post New Answer View All Answers
What is a constructor and how is it called?
State the difference between delete and delete[].
why is c++ called oops? Explain
How would you use the functions memcpy(), memset(), memmove()?
What is the use of :: operator in c++?
What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero
What is protected inheritance?
What are the implicit member functions of class?
What is abstraction in c++?
What is void pointer in c++ with example?
Define 'std'.
Explain what is oop?
Is c++ the most powerful language?
What is an orthogonal base class in c++?
Explain selection sorting. Also write an example.