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
Const char *p , char const *p What is the difference between the above two?
Explain about vectors in c ++?
Why Pointers are not used in C++?
How important is c++?
What things would you remember while making an interface?
Where Malloc(), Calloc(), and realloc() does get memory?
What is the difference between an enumeration and a set of pre-processor # defines?
Why we use #include iostream in c++?
What is split a string in c++?
What is token c++?
Explain how to initialize a const member data.
What does int * mean in c++?
Can we inherit constructor in c++?
Define stacks. Provide an example where they are useful.
what is C++ objects?