Draw an inheritance hierarchy for students at a university similar to the hierarchy shown in Fig. 12.2. 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.]

What will be an ideal response?

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.

Computer Science & Information Technology

You might also like to view...

A Web site that provides search capabilities on the Web is known as a(n):

A) Windows Defender B) search box C) Internet service provider D) search provider

Computer Science & Information Technology

A laptop is consistently loses it's wireless connection. What must a technician do to easily rectify this issue?

A. Use a USB to RJ-45 dongle B. Enable Bluetooth C. Enable NIC teaming D. Replace the motherboard

Computer Science & Information Technology