Original Post
hi, i just want to double check my logic on this. basically i have an object that contains a pointer to an array of pointers. when the destructor of this object is called, i (obviously) want to be sure that i first delete each elements heap memory prior to deleting the pointers on the heap. for example...
class Item{//...};
class foo{
Item** pItemList;
Item()
{//...build an itemList}
~Item()
{
for(int x=0; x < itemCount; x++)
{
delete itemList[x]; //delete heap mem at element x
}
delete[] itemList;
}
};
am i on track with this? pointers to pointers to... always confuse me a bit.
..:: mirirom ::..