Using your Chapter 5, Exploring Classes in Detail, solution, create a (mathrm{C}++) program to build an inheritance

Question:

Using your Chapter 5, Exploring Classes in Detail, solution, create a \(\mathrm{C}++\) program to build an inheritance hierarchy, generalizing person as a base class from the derived class of student.

1. Decide which data members and member functions of your student class are more generic and would be better positioned in a Person class. Build your Person class with these members, including appropriate constructors (default, alternate, and copy), a destructor, access member functions, and a suitable public interface. Be sure to place your data members in the private access region.

2. Using a public base class, derive student from Person. Remove members from student that are now represented in Person. Adjust constructors and the destructor accordingly. Use the member initialization list to specify base class constructors as needed.

3. Instantiate both student and Person several times and utilize the appropriate public interfaces on each. Be sure to dynamically allocate several instances.

4. Add a message using cout as the first line in each of your constructors and as the first line in your destructors so that you can see the construction and destruction order of each instance.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer: