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
What is virtual base class?
Explain binary search.
Is there a c++ certification?
When does a 'this' pointer get created?
What is array in c++ pdf?
How to declaring variables in c++?
What are vectors used for in c++?
What is the best c++ book?
Describe the setting up of my member functions to avoid overriding by the derived class?
What are pointers used for c++?
Can union be self referenced?
Can user-defined object be declared as static data member of another class?
What is ctime c++?
Is it possible for a member function to delete the pointer, named this?
What is friend class in c++ with example?