delete[] ???


2004-06-03 12:04:10 PM
cppbuilder59
I have a form which has two types of TPanels on it. One is a Array of
TPanels one a lone TPanel.
I am trying to delete as follows
for(int x=0;x<this->ComponentCount;x++)
if(this->Components[x]->ClassNameIs("TPanel"))
delete this->Components[x--];//side effect -- on x to account for
delete
//why error??
delete[] pnlComponent;
I know the TPanel Array is deleted but I thought once I was done deleting
each TPanel of the Array I had to also delete the pointer to the Array as
well. Am I mistaken about this? That last line does toss an error.
Warren