Correct Answer: B
Explanation/Reference:
Explanation:
In the composition approach, the subclass becomes the "front-end class," and the superclass becomes the
"back-end class." With inheritance, a subclass automatically inherits an implemenation of any non-private
superclass method that it doesn't override. With composition, by contrast, the front-end class must
explicitly invoke a corresponding method in the back-end class from its own implementation of the method.
This explicit call is sometimes called "forwarding" or "delegating" the method invocation to the back-end
object. Note: Composition means the same as:
* contains
* is part of
Note 2: As you progress in an object-oriented design, you will likely encounter objects in the problem
domain that contain other objects. In this situation you will be drawn to modeling a similar arrangement in
the design of your solution. In an object-oriented design of a Java program, the way in which you model
objects that contain other objects is with composition, the act of composing a class out of references to
other objects. With composition, references to the constituent objects become fields of the containing
object. To use composition in Java, you use instance variables of one object to hold references to other
objects.