In my library object that take cares of the array has a little problem deleting a single emlement. Also I should mention that every element of that array creates a new pointer by using an new command to a specific object (that is derived by my Volume abstract class).
My Volume Object has:
1 2 3 4
int id_no;
string title;
int borrower;
bool AllowBorrow;
So as I understand delete theVolumes[4] should do is to free the pointer. Now when I list all the elements of the array after 1 element has been deleted it shows me that only the STRING is gone but not the int:s.
Why is that, do I have to specifically tell the destructor of the abstract or derived class what should be removed?
Why is that, do I have to specifically tell the destructor of the abstract or derived class what should be removed?
NO, but if you were writing a program that required a sanitize of memory that is released, then you'd have to ensure that on your own. A default destructor for that object will not sanitize anything for you or reset the objects to a zero initialized state. If the Volume object itself had pointers to other things then you would have to ensure that the destructor explicitly destroys those things. The string has its own destructor whereas the other attributes are for built in types. The difference is that within the string it also has its own pointer to yet another block of memory. it is a more complex object which is probably the source of your confusion when you inspect the released memory.