pointers - When to delete/dereference in C++ -
myobj* var = new myobj; var = other1;
don't need anymore
delete var; var = new myobj; var = other2;
why can't dereference instead of deleting , allocating again?
var->other2;
dereference not mean delete: http://en.wikipedia.org/wiki/dereference
i suggest go through tutorials on c++, seem have misunderstanding of lot of vocabulary means.
remember utilize google.
c++ pointers dereference
No comments:
Post a Comment