This is a UML class diagram example.
The telephone set has a number of parts: ringer, answering machine, and caller ID display. The answering machine, in turn, may contain a number of recorded messages. The relationship among the telephone set and its parts is an aggregation relation, since the parts are made and can be destroyed independently of the telephone set. The relation between the answering machine and its recorded messages is a composition relation, since the messages are created and destroyed by the machine. The messages cannot exist without the machine. The telephone set is connected to the line, by which it can dial other lines. The line can also signal the telephone set in order to notify an incoming call. The relation between the line and telephone set is thus a two-way association. An excerpt of the class diagram of this system in depicted in this class diagram example.