Of Destructors And Destruction...
This is another of my what-if questions. How do member functions behave in objects being destroyed? Example: I have an object. lets call him Bob. Excuse the poor syntax as im writing this on the fly, and not compiling it.
Code:
class Bob
{
public:
Bob();
~Bob();
static void hokey_pokey() { while(1) { this->shake(); } return; }
private:
void shake(); // do whatever.
};
What happens to executing member functions when they are destroyed? For example, if I were running hokey_pokey in a thread, and for some reason delete were called on a Bob floating around on the heap. What would happen to the function shake when it was executed? Would it continue trying to execute the function, and crash because instead of instructions it gets garbage? What about static member functions, would they survive? Any ideas would be greatly appreciated. Thanks for your time.