Page 701 - AP Computer Science A, 7th edition
P. 701

32. (C) Composition is the has-a relationship. A PlayerGroup has-a Player (several of them, in fact). Inheritance, (choice D) is the is-a relationship, which doesn’t apply here. None of the choices A, B, or E apply in this example: An interface is a single class composed of only abstract methods (see p. 144); encapsulation is the bundling together of data fields and operations into a single unit, a class (see p. 93); and PlayerGroup and Player are clearly dependent on each other since PlayerGroup contains several Player objects (see p. 212).


































































































   699   700   701   702   703