c++ - Is calling non-member function from destructor OK? -
in c++, ok call non-member function (either free function or member of other objects) within destructor? calling (non-virtual, although in case shouldn't matter) method of object of different class. method crashes on trying access members.
on other hand, if different object child of destructed object (qt), matter?
in general destructor can call function needs destroy object. however, there couple of caveats:
if function called destructor throws exception, exception must caught , handled in destructor.
the function called destructor must not unconditionally create , destroy objects of type destructor belongs (since result in infinite recursion).
Comments
Post a Comment