CException::Delete

CException::Delete
void CException::Delete();
說明:
此函式檢查CException對象是否在堆頂建立,如果在堆頂建立,對該對象做刪除操作。當刪除該CException對象後,使用Delete成員函式刪除異常。不要直接使用刪除操作,因為CException對象可能是一個全局對象或者是在棧中創建的。
你可以指定當對象被創建時是否應被刪除。要了解更多信息,請參閱CException::CException。
如果使用C++“試抓”(try-catch)機制,只需調用Delete。如果使用MFC的TRY和CATCH宏,這些宏會自動調用此成員函式。
MSDN 解釋如下:
CException::Delete
void CException::Delete( );
Remarks
This function checks to see if the CException object was created on the heap, and if so, it calls the delete operator on the object. When deleting a CException object, use the Delete member function to delete the exception. Do not use the delete operator directly, because the CException object may be a global object or have been created on the stack.
You can specify whether the object should be deleted when the object is constructed. For more information, see CException::CException.
You only need to call Delete if you are using the C++ try-catch mechanism. If you are using the MFC macros TRY and CATCH, then these macros will automatically call this function.

相關詞條

熱門詞條

聯絡我們