Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


You 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.


The 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: