1Z0-804 · Question #20
Given: Which three are true?
The correct answer is B. SuperCar uses composition. C. BasicCar is-a Car. E. SuperCar takes advantage of polymorphism. B: The relationship modeled by composition is often referred to as the "has-a" relationship. Here SuperCarhas-a Car. C:The relationship modeled by inheritance is often referred to as the "is-a" relationship. Modeling an is-arelationship is called inheritance because the…
Question
Given:
Which three are true?
Options
- ABasicCar uses composition.
- BSuperCar uses composition.
- CBasicCar is-a Car.
- DSuperCar is-a Car.
- ESuperCar takes advantage of polymorphism
- FBasicCar has-a Car
How the community answered
(53 responses)- A4% (2)
- B72% (38)
- D15% (8)
- F9% (5)
Explanation
B: The relationship modeled by composition is often referred to as the "has-a" relationship. Here SuperCarhas-a Car. C:The relationship modeled by inheritance is often referred to as the "is-a" relationship. Modeling an is-arelationship is called inheritance because the subclass inherits the interface and, by default, theimplementation of the superclass. Inheritance of interface guarantees that a subclass can accept all the samemessages as its superclass. A subclass object can, in fact, be used anywhere a superclass object is called for. E:The polymorphic method call allows one type to express its distinction from another, similar type, as long asthey're both derived from the same base type. This distinction is expressed through differences in behavior ofthe methods that you can call through the base class.
Topics
Community Discussion
No community discussion yet for this question.