#include #include #include "announcer.h" using namespace std; //Function declarations void f(); void g(); int main() { cout << "At start of main, we have " << announcer::howMany() << " objects.\n"; const announcer methuselah {0}; f(); cout << "At end of main, we have " << announcer::howMany() << " objects.\n"; return EXIT_SUCCESS; //methuselah dies at this return. } void f() { cout << "At start of f, we have " << announcer::howMany() << " objects.\n"; const announcer f1 {10}; //Born in increasing order. const announcer f2 {20}; const announcer f3 {30}; g(); cout << "At end of f, we have " << announcer::howMany() << " objects.\n"; } //30, 20 10 die in decreasing order at this closing } void g() { cout << "At start of g, we have " << announcer::howMany() << " objects.\n"; const announcer a[] { //Born in increasing order. announcer {40}, //Call the constructor 3 times ... announcer {50}, //... to construct an array of 3 objects announcer {60} }; cout << "At end of g, we have " << announcer::howMany() << " objects.\n"; } //60, 50, 40 die in decreasing order at this closing }