Draw an inheritance hierarchy for students at a university. Use Student as the base class of the hierarchy, then include classes UndergraduateStudent and GraduateStudent that derive from Student. Continue to extend the hierarchy as deep (i.e., as many levels) as possible. For example, Freshman, Sophomore, Junior and Senior might derive from UndergraduateStudent, and DoctoralStudent and MastersStudent might derive from Graduate- Student. After drawing the hierarchy, discuss the relationships that exist between the classes. [Note: You do not need to write any code for this exercise.]
The Answer to the Question
is below this banner.
Can't find a solution anywhere?
NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?
Get the Answers Now!You will get a detailed answer to your question or assignment in the shortest time possible.
Here's the Solution to this Question
Solution
This hierarchy contains many “is-a” (inheritance) relationships. An UndergraduateStudent is a Student.
A GraduateStudent is a Student too. Each of the classes Freshman, Sophomore, Junior and Senior is an UndergraduateStudent and is a Student. Each of the classes DoctoralStudent and MastersStudent is a GraduateStudent and is a Student.
Each of the classes DoctoralStudent and MastersStudent is a GraduateStudent and is a Student.