Copy Class Object, destroy original object, why copy becomes NULL?

  • Thread starter Thread starter KeanHeng
  • Start date Start date
K

KeanHeng

Guest
Guys...



Basically, I'm trying to clone a class object. Then delete original. But my copy also becomes NULL?


Can anyone explain why this happened? And how to do proper clone copy?



// library
m_dataPage.SetInfo(dtStartTime, dtEndTime, false);
InsertSubPage(&m_dataPage);
CreateSheet(); // display as full screen

// application level, manipulate object to display as TabControl
CPropertyPage* pg_copy = dynamic_cast<CPropertyPage*>(&m_dataPage);

m_tabCtrl.AddTab("My Tab Pages",pg_copy); // ? pg_copy = NULL when m_dataPage is deleted
DeletePage(&m_dataPage);

Please advise....

Continue reading...
 
Back
Top