hmm how about that code for expanding the dynamic array:
is there a memory leaking here too?Code://save old values T tArr[aSize]; for(int i=0; i<aSize; i++) tArr[i] = nArr[i]; delete[] nArr; //create new array nArr = new T[aSize+1]; for(int i=0; i<aSize; i++) nArr[i] = tArr[i]; nArr[aSize] = nVal; aSize++;