To model a part-whole relationship, you (usually) need these parts:
- An instance variable in the part to point to the whole.
- Connect (and disconnect) methods in the part to point to the whole. (Sometimes you do this in the
initialize method.
- An instance variable in the whole that tracks the collection of parts.
- Connect (and disconnect) methods in the whole that point to the parts.