Chapter 16

Answers to Chapter 16 Review Questions

1: You have just started working on two software projects and identified the following classes in the two programs:

Program 1: Airplane, jet engines, wings, airplane body, passenger seats, and cockpit

Program 2: Person, student, employee, undergraduate, graduate, secretary, cleaner, and director

Which program seems able to benefit the most from inheritance? Why? Which concept is the other program likely to benefit from?

A1: Program 1 contains an airplane and the parts of an airplane. We can say airplane has-a jet engine and airplane has-a wing and so on. Consequently, it seems the aggregation concept will play an important role when implementing program 1.

In program 2, we find many is-a relationships. ...

Get C# Primer Plus now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.