المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Deleting the Main Window



C++ Programming
04-02-2009, 08:30 PM
I am currently writing an application using C++ and MFC. As you might expect in the method InitInstance, I call new to create an instance of the main window class. I assign this pointer to m_pMainWnd. However, I am never freeing the object being created there. I feel this is a problem.

I plan to delete the object in the routine ExitInstance. I would think this would be standard practice but I have not seen any examples in my MFC books that do this. I am wondering why. Could it be that these authors do not do this because they feel it is does not matter since the application will terminate anyway? I kind of feel that they should.

Please comment.

Thanks

Bob