Self-Review Exercises (Sections G.1G.5)

G.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 reference 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.

G.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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset