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
Can a Structure contain a Pointer to itself?
How can you specify a class in C++?
How to declare a function pointer?
If all is successful, what should main return a) 0 b) 1 c) void
Explain this pointer?
Differentiate between an array and a list?
Why is it necessary to use a reference in the argument to the copy constructor?
How does code-bloating occur in c++?
Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.
Explain the use of this pointer?
How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?
How can a called function determine the number of arguments that have been passed to it?
What is c++ good for?
Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. Your program should work for squares of all side sizes between 1 and 20. --- │ │ │ │ │ │ ---
What is c++ code?