Name: ___________________________________

Copy Constructors and Operator Overloading

Part 1: These questions are based upon exercises in the T. Gaddis book.

Write the code, compile, and test the following exercise. The class interface (.h), class implementation (.cpp), and main program (.cpp) should be stored in three separate files.

Design a TestScores class that has a pointer member variable to hold test scores. The class should have a constructor that allows the user to specify the number of test scores. The constructor then dynamically allocates the memory. Demonstrate the class by writing a separate program that creates at least 2 instances of the class. The program should ask the user the number of test scores, and then define a TestScores object. The program should call the mutator function to prompt the user for the values, storing them in the TestScores object. Then, the program should display the TestScores in the object, by calling the accessor member function. Display the average of your test scores.

When you instantiate the second TestScores object, initialize it to the first object (to test the copy constructor). Then, make changes, and test the assignment operator.