If I have a class with an array of pointers to another Vehicle class:
class List {
public:
private:
Vehicle ** vehicles;
}
If I write a class destructor now List, do a manual iteration over the array (I know how many elements are in the array) and deleteeach pointer to the vehicle, or C ++ will automatically call the destructors of all vehicles in the array?
(As in the case if the class has a separate line / ... or it will be a container of STL pointers of the vehicle)
EDIT: I forgot about delete [] vehicles, but if I did, would it also delete the memory used by all the machines in the array, or would it just delete the memory used by pointers?
Aerus source
share