#include #include #include "announcer.h" using namespace std; announcer *a[] { //an array of 3 pointers nullptr, nullptr, nullptr }; void constructObjects(); void destructObjects(); int main() { constructObjects(); cout << "\n"; cout << announcer::howMany() << " objects still exist.\n\n"; destructObjects(); return EXIT_SUCCESS; } void constructObjects() { //Construct 3 objects in 3 blocks of memory. a[0] = new announcer {"A0"}; a[1] = new announcer {"A1"}; a[2] = new announcer {"A2"}; } void destructObjects() { delete a[1]; //no [], because we're deleting one object, not an array delete a[0]; delete a[2]; }