Implementing Hierarchies with Single Inheritance, solution, augment your inheritance hierarchy to further specialize student with Graduate Student

Question:

Implementing Hierarchies with Single Inheritance, solution, augment your inheritance hierarchy to further specialize student with Graduate Student and Non-Degree Student.

1. Add necessary data members to your Graduate student class. Data members to consider might be dissertation topic or graduate advisor. Include 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. Do the same for Non-Degree Student.

2. Add polymorphic operations to Person, Student, Graduate Student, and Non-Degree Student as necessary. Introduce at the Person level virtual functions IsA() and Print(). Override IsA () and Print () in your derived classes as necessary. It may be that you override IsA() in student and Graduate student, but choose to override Print() only in the student() class. Be sure to include virtual destructors in each of your classes.

3. Instantiate student, Graduate Student, Non-Degree Student, and Person several times and utilize the appropriate public interfaces on each. Be sure to dynamically allocate several instances.

4. Create an array of pointers to Person and allocate instances of Person, Student, Graduate Student, and Non-Degree Student to be members of this array. Once generalized, only call polymorphic operations that are found at the Person level (and other public methods of Person). Be sure to delete any dynamically allocated instances.

5. Create an array of pointers to student and allocate only instances of GraduateStudent and NonDegreeStudent to be members of this array. Now, call operations that are found at the student level to be applied to these generalized instances. Additionally, utilize operations found at the Person level - they are inherited and additionally available for generalized student instances. Be sure to delete any dynamically allocated instances pointed to in your array.

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

Step by Step Answer: