InterviewSolution
| 1. |
What Are The Effects After Calling The Delete This Operator ? |
|
Answer» It is difficult for the compiler to KNOW whether an object is allocated on a stack or a heap. On INVOKING the delete this operator, the destructor is CALLED twice on the object related to the current context. Firstly implicitly and SECONDLY explicitly. It results in undefined behavior and error-prone conditions. The delete this operator can only WORK on three conditions:
It is difficult for the compiler to know whether an object is allocated on a stack or a heap. On invoking the delete this operator, the destructor is called twice on the object related to the current context. Firstly implicitly and secondly explicitly. It results in undefined behavior and error-prone conditions. The delete this operator can only work on three conditions: |
|