C++: what happens when you delete a pointer to an object of a class without explicit destructor? -
what happens when delete pointer object of class not have declared destructor?
every class (or struct) has destructor (unless pod. if not declare 1 compiler add implicit destructor. take following class example:
struct { std::string test; };
no destructor defined a. yet has one, because compiler automatically adds it. isn't empty. call destructor of test, because std::string has destructor itself.
Comments
Post a Comment