static CBox* m_Ptr; CBox::CBox()
{
m_ptr= this;
}
CBox* GtBox()
{
return m_Ptr;
}
Is an absolutely bad idea!!!
Static member variables are global variables, so to speak, that are scoped by the class namespace.
There will be only one instance of m_ptr, regardless of how many instances of the CBox exists. And when you do
m_ptr= this;
you can see how you going to end up in a hot water. You better off rewrite your function as:
CBox* GtBox()
{
return this;
}