3 ms·
The function's body is not part of the object itself. When you delete the object, you can keep executing the function just fine, as long as you don't access an
by machrider 17y ago
The function's body is not part of the object itself. When you delete the object, you can keep executing the function just fine, as long as you don't access any member variables.
- haseman 17y agoYou keep executing the function because it's on the stack. The program counter keeps moving through the method until it hits a return statement. God help you if you try to reference one of the class' internal data objects as their heap space could have been allocated to something else running on another thread.
- DanielBMarkham 17y agoThe function's body is not part of the object itself Most all of the time, yes. But the function could have been dynamically allocated to an instance of the object. You don't know from the definition of the question. A dynamic function, presumably, would be picked up by the dtor.