Why destructor is used when delete is there?

When delete is used to deallocate memory for a C++ class object , the object’s destructor is called before the object’s memory is deallocated (if the object has a destructor). If the operand to the delete operator is a modifiable l-value, its value is undefined after the object is deleted.

Sizin İçin Seçtik  How do you call a destructor in C++?

Leave a Reply

Your email address will not be published. Required fields are marked *