Skip to content
ExamSpine

Answer it

Composition, aggregation or inheritance at a school

5 marksYou mark it yourself against the marking points

A school timetable program has these classes: School, Room, Club, Student and Person.

  • A School object creates its own Room objects. A room only exists as part of its school, and if the school is removed from the program, so are its rooms.
  • A Club holds a list of the Student objects that belong to it. Students exist before they join and stay after the club is closed.
  • A Student is a kind of Person, with an extra student number.

(a) Identify the relationship between each pair: School and Room, Club and Student, Student and Person. [3]

(b) A programmer suggests making Student a subclass of Club, so a student can use the club's list. Explain why this is a poor design. [2]

[5]

Report a problem with this page