//tstud1.cpp //test driver for Constructors/Destructors example //(constructor with default arguments and copy constructor) #include "student1.h" #include main() { //constructor with default arguments used Student freshman; Student *freshman1 = new Student; //constructor with parameters used Student lion ("Lion King"); Student junior("James P. Johnson", 97); Student *senior = new Student("Barbara Simon", 78); //copy constructor used Student sophmore(freshman); Student upper_senior(*senior); Student *graduate = new Student(junior); cout<<"\t\tConstructors/Destructors example output"<print(); cout<<"\nAfter parameterized constructor:\n"; lion.print(); junior.print(); senior->print(); cout<<"\nAfter copy constructor:\n"; sophmore.print(); upper_senior.print(); graduate->print(); cout<<"\nNow destructor will be invoked:\n\n"; //invoking destructor for pointer to a class object - //by applying operator 'delete' delete freshman1; delete senior; delete graduate; //destrucor for an automatic class object is invoked //automatically return 0; }