MFC has a class named CWinApp, and CWinApp has a destruction
function called ~CWinApp(). Now I want to override ~CWinApp()
yet still want to call the original version of ~CWinApp(), the code
is as follows:
Code:
void wrap(void)
{
CWinApp::~CWinApp();
}
CWinApp::~CWinApp()
{
if(GetCurrentProcessId() != process_id)
return; // do nothing!
else
{
wrap(); // It seems wrap() calls the overridden ~CWinApp(),
// not the original one, thus it should not be called here.
// Then, how to call the original ~CWinApp() here?
}
}