What information is stored in an Event object? If the event comes from the keyboard, the relevant information is the key that was pressed. If the event comes from the mouse, the relevant information is the location of the mouse cursor and the status of the mouse buttons. These are two distinct types of event, so you can make two separate classes, KbdEvent and MouseEvent.
What can a KbdEvent or a MouseEvent do? These classes don't do much, except report the information they contain. They're little more than fancy structures.
Even though these two classes don't appear to share anything in common, you can derive them both from an abstract base class Event as a way of indicating that both represent types of events. This provides a single means of referring to both types of events so that, if desired, objects of either type could be passed to a function. This technique will be discussed in more detail in the section “The Event Hierarchy.”
This event hierarchy is shown in Figure 10.3.