//----------------------------------------------------------------- // Author: Zhixiang Chen // Class: CSCI/CMPE 2380, Spring 2009 // Lab 7: Destructor under inheritance vs. virtual destructor // Also, watch the chain reaction of constructor/desctructor calling // Date: January, 2009 // Comment: The code here is meant to be revised. // //----------------------------------------------------------------- // // This lab exercise is practice virtual destructor // // Compile and run your program. When everything is fine, // print your .cpp and .h files and turn them to me or the TA. // ***************************************************************** #include < iostream > #include < fstream > #include < string > #include < cstring > #include < cmath > #include < cstdlib > #include < iomanip > #include < vector > #include #include "lab2380_7_head.h" using namespace std; bool fun(); //define function fun int main() { bool tag = false; int i=0; /***************************************************************************** Part One: Test non-virtual destructor *****************************************************************************/ while(i<10) { tag = fun(); //inside fun, a class D object is created. //once outside fun, this object dies and the destructor //is called to deallocated memory i++; cout<<"This is the end of iteration "<< i <