DIntroduction to UML

Unified Modeling Language, or UML, is the industry standard for diagrams visualizing class hierarchies, subsystem interactions, sequence diagrams, and so on. This book uses UML for its class diagrams. Explaining the entire UML standard warrants a book in itself, so this appendix is just a brief introduction to only those aspects of UML that are used throughout this book, which are class diagrams. There are different versions of the UML standard. This book uses UML 2.


UML defines the following collection of types of diagrams:

  • Structural UML diagrams
    • Class diagram
    • Component diagram
    • Composite structure diagram
    • Deployment diagram
    • Object diagram
    • Package diagram
    • Profile diagram
  • Behavioral UML diagrams
    • Activity diagram
    • Communication diagram
    • Interaction overview diagram
    • Sequence diagram
    • State diagram
    • Timing diagram
    • Use case diagram

Because this book only uses class diagrams, that is the only type of diagram that is discussed further in this appendix.


Class diagrams are used to visualize individual classes and the relationships between different classes, both are discussed in the next sections.

Class Representation

A class is represented in UML as a box with a maximum of three compartments, containing the following:

  • The name of the class
  • The data members of the class
  • The methods of the class

Figure D-1 shows an example.


MyClass has two data members—one of type string, the other of type float—and it has two ...

Get Professional C++, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.