View Single Post
  #1  
Old 08-13-2014, 21:26
BlackWhite BlackWhite is offline
Friend
 
Join Date: Apr 2013
Posts: 80
Rept. Given: 4
Rept. Rcvd 14 Times in 6 Posts
Thanks Given: 12
Thanks Rcvd at 48 Times in 21 Posts
BlackWhite Reputation: 14
How to call the original function when it's overridden?

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?
   }
}
Reply With Quote