c++ - calling a self destructor from inside a method -


i wanted know if possible call destructor of class own method. instance have class foo created such

foo* f = new foo(); 

now suppose foo has method called finalize

void foo::finalize() {    //do finalizing code    //delete instance; } 

is possible finalize call destructor of foo , recover memory allocated new ? if how ?

you can call delete this; delete object within method


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -