//+——————————————————————+ //| Deletes list by deleting its elements | //+——————————————————————+ void CMyList::Destroy() { //— service pointer for working in the loop CItem* item; //— go through loop and try to delete dynamic pointers while(CheckPointer(m_items)!=POINTER_INVALID) { item=m_items; m_items=m_items.Next(); if(CheckPointer(item)==POINTER_DYNAMIC) { Print(“Dynamyc object “,item.Identifier(),” to be deleted”); delete (item); } elsePrint(“Non-dynamic object “,item.Identifier(),” cannot be deleted”); } //— }