2Chapter 9 Object-Oriented Programming: Inheritance
Self-Review Exercises
9.1 Fill in the blanks in each of the following statements:
a) is a form of software reusability in which new classes acquire the members of
existing classes and embellish those classes with new capabilities.
b) A superclass’s members can be accessed in the superclass declaration and in
subclass declarations.
c) In a(n) relationship, an object of a subclass can also be treated as an object of
its superclass.
d) In a(n) relationship, a class object has references to objects of other classes as
members.
e) In single inheritance, a class exists in a(n) relationship with its subclasses.
f) A superclass’s members are accessible anywhere that the program has a refer-
ence to an object of that superclass or to an object of one of its subclasses.
g) When an object of a subclass is instantiated, a superclass is called implicitly
or explicitly.
h) Subclass constructors can call superclass constructors via the keyword.
9.2 State whether each of the following is true or false. If a statement is false, explain why.
a) Superclass constructors are not inherited by subclasses.
b) A has-a relationship is implemented via inheritance.
c) A Car class has an is-a relationship with the SteeringWheel and Brakes classes.
d) When a subclass redefines a superclass method by using the same signature, the subclass
is said to overload that superclass method.
Exercises
NOTE: Solutions to the programming exercises are located in the ch09solutions folder.
Each exercise has its own folder named ex09_## where ## is a two-digit number representing
the exercise number. For example, exercise 9.3’s solution is located in the folder ex09_03.
9.4 (Software Reuse) Discuss the ways in which inheritance promotes software reuse, saves time
during program development and helps prevent errors.