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 the real purpose of class – to export data?
What is the prototype of printf function?
daily Routine of father
What is the purpose of extern storage specifier?
What is the difference between ++ count and count ++?
Is swift faster than c++?
Can a new be used in place of old mallocq? If yes, why?
When should you use global variables?
What gives the current position of the put pointer?
What are the different types of polymorphism in c++?
Explain the uses of static class data?
What data structure is fastest, on average, for retrieving data: a) Binary Tree b) Hash Table c) Stack
How did c++ get its name?
the first character in the variable name must be an a) special symbol b) number c) alphabet
What is the basic structure of c++ program?