← Quiz: Inheritance: all 10 questions
Quiz: Inheritance · Question 5 of 10
"A Car has an Engine" is modelled best with:
"A Car has an Engine" is modelled best with:
- A.Inheritance (Car extends Engine)
- B.Composition (Car holds an Engine object)
- C.Polymorphism
- D.An interface only
Answer & explanation
Correct answer: Composition (Car holds an Engine object)
It's a has-a relationship, so composition fits.
Can you get the rest right without peeking?
Take the timed Quiz: Inheritance quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →