Which is true? (Choose all that apply.)
A. Woop is-a Hmpf and has-a Zing.
B. Zing is-a Woop and has-a Hmpf.
C. Hmpf has-a Woop and Woop is-a Zing.
D. Woop has-a Hmpf and Woop is-a Zing.
E. Zing has-a Hmpf and Zing is-a Woop.
Answer:
D is correct, Woop inherits a Hmpf from Zing.
A, B, C, and E are incorrect based on the preceding.
(Objective 5.5)
==
class Zing { protected Hmpf h; } class Woop extends Zing { } class Hmpf { }
No comments:
Post a Comment