Re: i guess you can do so:
Quote:
Originally posted by atandix
Code:
void Array<BType, IType>::grow(int newS)
{
//assume thatyou have an pointor in Array<BType,IType>:
//Type* old,
Type *tmp=new Type[newS];
//copy the elements to the new one that on the heap
......
delete old;
old =tmp;
}
i'm a beginner too.
hope that helps...
I believe you should have put brackets inbetween your delete and old. So the new line would look like this:
delete [] old;
Remember when calling delete, you put the empty brackets for deleting single AND multi-dimensional arrays.