Which three are true?

Given:

Which three are true?

Given:

Which three are true?

A.
BasicCar uses composition.

B.
SuperCar uses composition.

C.
BasicCar is-a Car.

D.
SuperCar is-a Car.

E.
SuperCar takes advantage of polymorphism

F.
BasicCar has-a Car

Explanation:
B: The relationship modeled by composition is often referred to as the “has-a” relationship. Here SuperCar has-a Car.
C:The relationship modeled by inheritance is often referred to as the “is-a” relationship. Modeling an is-a relationship is called inheritance because the subclass inherits the interface and, by default, the implementation of the superclass. Inheritance of interface guarantees that a subclass can accept all the same messages 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 as they’re both derived from the same base type. This distinction is expressed through differences in behavior of the methods that you can call through the base class.



Leave a Reply 4

Your email address will not be published. Required fields are marked *