The Vec setSize(newSize) method should follow these steps:
- If mySize and newSize are different:
- If newSize is zero:
- Deallocate myArray;
- Set myArray to NULL;
- Set mySize to zero.
- Allocate a new dynamic array of Items, storing its address in local variable newArray.
- If mySize is less than newSize:
Otherwise, just copy newSize values from myArray into newArray.
- Copy mySize values from myArray into newArray.
- Set the remaining (newSize-mySize) values to zero.
- Set mySize to newSize.
- Deallocate myArray.
- Set myArray to newArray.