dimanche 2 novembre 2014

What will get removed if i remove a pointer in c++


Vote count:

0




If I remove a pointer to an object, what will be removed? Only the pointer or also the object which the pointer points to? For example:


Assume I have a class with a variable



int *root


If I do the following in a method of that class



int *current = root;
delete current;


Will root also be deleted or only the pointer current?



asked 20 secs ago







What will get removed if i remove a pointer in c++

Aucun commentaire:

Enregistrer un commentaire