Say I get into the situation I know that I will want an object deleted - when I am executing code part of a member function of said object. In other words after the function has returned whatever it is to return I want the object to be destructed. Do there exist techniques or design patterns suitable for this situation? I guess trying to call destructor from inside any object is not safe (or even allowed?)
Answers explaining why this is a bad idea and how to do instead will also be welcome.
Aucun commentaire:
Enregistrer un commentaire