#include<iostream>
usingnamespace std;
class animal
{
//random stuff here
}
//following stuff
int main()
{
animal animalGroup = new animal[5]
//say you already initilized all the animals already from the array
delete animalGroup[3]; // say if I wanted to delete the third one only
return 0;
}
No. The size of an array is constant for its entire lifetime.
You could
1) use vectors
2) replace animalGroup[3] with some special dummy animal to indicate that this array element is empty
3) copy animalGroup[4] over to animalGroup[3] and pretend that animalGroup[4] no longer exists (e.g. by maintaining a size variable)
4) create a new array of size 4, copy all elements except animalGroup[3] over, and delete the old array