Pointers and collection of pointers in C++. How to properly delete.
- by Julen
Hello,
This is a newbe question but I have alwasy doubts with pointers in C++. This is the situation.
I have a class A which as a collection (a vector actually) of pointers of class B. This same class A has another collection of pointers to class C. Finally the objects of class B have also a collection to pointers to class C which point to the same instances the class A points to.
My question is, if I delete a member of class-C-type pointer in class B, what happens to the pointer in class A that points to the deleted instance of class C? How this situation has to be treated?
Thanks a lot in advance!
Julen.