#include #include using namespace std; //------------------------------------------------------------- class Person { public: string firstName ; string lastName ; int age ; public: void print() { cout << firstName << " : " << lastName << ": " << age << endl ; } ~Person() { cout << "Person Destructor for " << firstName << " : " << lastName << endl ; } Person() { age = 42 ; firstName = "Sunny" ; lastName = "Liston" ; cout << "Person constructor with no arguments." << endl ; } Person( int ageP ) { age = ageP ; firstName = "Jack" ; lastName = "Johnson" ; cout << "Person constructor with single argument." << endl ; } Person(int ageP, string firstNameP, string lastNameP) { age = ageP ; firstName = firstNameP ; lastName = lastNameP ; cout << "Person Constructor with arguments.\n" ; } }; //------------------------------------------------------------- int main() { //An array of pointers to the Person object Person* arrayOfObjects[5] ; for( int i1=0 ; i1 < 5 ; i1++ ) { arrayOfObjects[i1] = new Person(55) ; } //for for( int i1=0 ; i1 < 5 ; i1++ ) { arrayOfObjects[i1]->print() ; } //for for( int i1=0 ; i1 < 5 ; i1++ ) { delete( arrayOfObjects[i1] ) ; } //for return(0) ; }//-------------------------------------------------------------