Original Post
Hi,
What kind of problem can occur if delete [this] class instance by call member function of another class?
--------------------------------------------------------------
Example:
void CUser::ChangeTool (Tool * pNewTool)
{
delete this->pToolInUse ; // CTool * pToolInUse ;
this->pToolInUse = pNewTool ;
}
and use the function above like this:
void CTool::ToolBroken ()
{
this->pUser->ChangeTool (new CTool) ; // CUser * pUser ;
// pUser->pToolInUse refers [this]
}
--------------------------------------------------------------
What is the potential problem? Any suggestions? I''ve no problem yet...