Hello,
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:Code: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?Code:if (pObject != NULL) { Object *pTemp = pObject; pObject = NULL; delete pTemp; }
Any help would be much appreciated!
Thanks



LinkBack URL
About LinkBacks


