Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
For each pair, say whether you would use inheritance (is a) or composition (has a), and why.
Teacher and PersonLibrary and BookCircle and ShapePhone and BatteryStack and listHave you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Plan. Say the sentence aloud, both ways, and keep the one that sounds right.
Check. The last one is a famous case. If the child allows things that the parent allows but the idea forbids, "is a" is false.
Answer: inheritance, composition, inheritance, composition, composition.
Log in to join the discussion.
Loading…