共用方式為


Cleaning Up Documents and Views

When a document is closing, the framework first calls its DeleteContents member function. If you allocated any memory on the heap during the course of the document's operation, DeleteContents is the best place to deallocate it.

注意

You should not deallocate document data in the document's destructor. In the case of an SDI application, the document object might be reused.

You can override a view's destructor to deallocate any memory you allocated on the heap.

See Also

Concepts

Initializing and Cleaning Up Documents and Views