← Quiz: Inheritance, ABC and MRO: all 10 questions
Quiz: Inheritance, ABC and MRO · Question 9 of 10
A Library has many Books. Which design fits best?
A Library has many Books. Which design fits best?
- A.class Library(Book)
- B.class Book(Library)
- C.A Library object holding a list of Book objects (composition)
- D.Multiple inheritance from Library and Book
Answer & explanation
Correct answer: A Library object holding a list of Book objects (composition)
A library is not a book; it has books. That is a has-a relation.
Can you get the rest right without peeking?
Take the timed Quiz: Inheritance, ABC and MRO quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →