0
How to delete array of objects in C++? Proof by C++ code for proper deletion
2 Answers
+ 1
//try this.
Class_type pointer = NULL;
pointer = new Class_type[16];
delete [ ] pointer;
If you need proof they are all deallocated then you could add a message output to the class destructor. Or better yet create a static member that holds the number of objects.
0
I'd say that, as objects are stored as pointer in an array, you can simply loop through the array and use the delete keyword to delete the pointers, then delete the array
(no proof though, I don't really code in c++ anymore)