/******************************************************************************************** *** FILE: virtual_destructor.cpp *** DATE: 03/02/2004 *** AUTHOR: Daniel Dementiev *** GOAL: This is an example program for IST482 class. It illustrates the difference *** between a virtual destructor and usual one. *** Instructior: *** 1. compile the program using MS C++ command line compiler: *** ...> cl virtual_destructor.cpp /EHsc *** 2. run the program and notice the output *** 3. in line 26 comment the keyword virtual and recompile the program *** 4. run it and compare the outputs ********************************************************************************************/ #include #include using namespace std; class Person { protected: string name; public: Person() : name("unknown") { cout<<"Creating object Person\n"; }; Person(char *n) : name(n) { cout<<"Creating object Person\n"; }; virtual ~Person() { cout<<"Destroying object Person\n"; }; virtual void Print() const { cout<<"Person::Print(): "<