Question: Chapter 11 Some programmers prefer not to use protected access because they believe it breaks the encapsulation of the base class. Discuss the relative merits

Chapter 11  Chapter 11 Some programmers prefer not to use protected access because

Some programmers prefer not to use protected access because they believe it breaks the encapsulation of the base class. Discuss the relative merits of using protected access vs. using private access in base classes. Draw an inheritance hierarchy for students at a university similar to the hierarchy shown in Fig. 11.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 Masters-Student might derive from GraduateStudent. After drawing the hierarchy, discuss the relationships that exist between the classes. The world of shapes is much richer than the shapes included in the inheritance hierarchy of Fig. 11.3. Write down all the shapes you can think of-both two-dimensional and three-dimensional- and form them into a more complete Shape hierarchy with as many levels as possible. Your hierarchy should have the base-class Shape from which class TwoDimensionalShape and class ThreeDimensionalShape are derived

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!