Answer Posted / hitout
There are different cases to this
1) If the memory is allocated in stack, delete this should
not be called since it calls destructor twice.
2) delete this can be called in all functions except
destructor if the memory is allocated on heap(ie if new
operator is used and the object is not explicitly deleted).
3) Delete this in destructor will always cause an infinite loop.
Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
Is c++ a good beginners programming language?
Why c++ is better than c language?
What is an overflow error?
What is meant by entry controlled loop?
Are php strings immutable?
What is the difference between a definition and a declaration?
Is there structure in c++?
What is an adaptor class in c++?
Why is c++ still popular?
What does catch(…) mean?
Explain static and dynamic memory allocation with an example each.
What is the use of structure in c++?
What are static type checking?
What are the uses of static class data?
Define a constructor - what it is and how it might be called (2 methods)?