I am a some what new C++ guy, and I am looking at someone else's code and this method of newing and deleting seems odd to me.
Is there anything wrong with this method of deleting?
first new an object:
Later when the object is deleted:
Object *pObject = new Object;
It seems to me that they are just deleting the pointer to pObject, and not actually reclaiming the memory. I am wondering why not just delete pObject, and then null Pobject pointer?
if (pObject != NULL)
Object *pTemp = pObject;
pObject = NULL;
Any help would be much appreciated!