#include "SimpleVector.h" #include class A { public: A() { mV.push_back( 50 ); mV.push_back( 60 ); } ~A() { printf( "A's destructor invoked\n" ); } SimpleVector mV; void print() { printf( "A{ " ); for( int i=0; i v; A a; v.push_back( a ); v.push_back( a ); // push more back to force vector expansion for( int i=0; i<10; i++ ) { v.push_back( a ); } /* printf( "making array\n" ); A *array = new A[100]; printf( "deleting array\n" ); delete [] array; printf( "About to exit\n" ); */ printf( "making w\n" ); SimpleVector w; w.push_back( a ); w.push_back( a ); // push more back to force vector expansion for( int i=0; i<10; i++ ) { w.push_back( a ); } printf( "deleting from w\n" ); // delete a few to test for leak w.deleteElement( 0 ); w.deleteElement( 0 ); { // copy constructor SimpleVector clone = v; printf( "clone = " ); for( int i=0; iprint(); } printf( "\n" ); // assignment operator clone = w; printf( "clone = " ); for( int i=0; iprint(); } printf( "\n" ); // clone deleted here } // v still okay? printf( "v = " ); for( int i=0; iprint(); } printf( "\n" ); // w still okay? printf( "w = " ); for( int i=0; iprint(); } printf( "\n" ); }