I have a linked list, and in one of the functions I create a new object that points to one of the objects one the list.
Node* newPointer=new Node;
newPointer=myList->getHead()->getNext();
Is it possible to delete THE POINTER, and the pointer only – not the pointed object. If I write
delete newPointer;
then the object itself is deleted. I don’t want to do that!
If it don’t delete the newPointer will this lead to memory leakage?
Hope anyone can help me
-xagiber-