Y
Yongming Wang
FuncA is called to delete itself with B's help.
In vc 7.0, case 1 seems invalid, but case 2 is valid.
Could anyone explain for me?
class A
{
public:
void FuncA()
{
B b(this);
};
void FuncB()
{
delete this;
};
}
class B
{
public:
B(A* pThis): m_pThis(pThis){};
//case 1
~B()
{ m_pThis.FuncB();}
//case 2
~B()
{delete pThis;}
}
~ Let us linux ~
In vc 7.0, case 1 seems invalid, but case 2 is valid.
Could anyone explain for me?
class A
{
public:
void FuncA()
{
B b(this);
};
void FuncB()
{
delete this;
};
}
class B
{
public:
B(A* pThis): m_pThis(pThis){};
//case 1
~B()
{ m_pThis.FuncB();}
//case 2
~B()
{delete pThis;}
}
~ Let us linux ~