What are the relationships between the classes identified thus far? A text window can have one or two scroll bars. Each scroll bar is said to be a child of the text window, and the text window is the parent of the scroll bar(s). This can be represented as a containing relationship, where Win contains one or two instances of ScrollBar as member objects. Win therefore uses ScrollBar.
The interaction between windows and scroll bars requires two-way communication, since using the scroll bar affects the window and moving the window's cursor affects the scroll bar. As a result, scroll bars must also have knowledge of text windows. This differs from the situation where, for instance, a circle contains a point to represent its center; Circle must know about Point, but the reverse is not true. ScrollBar must know about the interface of Win to communicate with it.
Events are passed to interactors, whether text windows or scroll bars, so Interactor must have a member function that accepts an Event object as a parameter. Interactor thus uses Event.
Note that Win must be defined before WinMgr, since WinMgr manipulates Win objects. Since it's possible to have an arbitrary number of windows, Wins cannot be member objects. Instead, you can make WinMgr a collection class, which allows you to insert or delete Win objects. WinMgr also uses Events, since it passes them to the windows.
However, since scroll bars never exist independently and are never stacked on each other, it is unnecessary for a WinMgr to manipulate ScrollBar or generic Interactor objects.
The relationships between the classes are shown in Figure 10.4.