Mappings between C/C++ and UML elements

In class diagrams, UML notation is used to represent C/C++ elements, the fields and methods that comprise an element, and the relationships between C/C++ elements.

Class diagrams represent not only C/C++ classes, but other C/C++ elements such as structs, enums, unions, and typedefs.

A stereotype is an extension mechanism that broadens the vocabulary of the UML and gives more specific meaning to a C/C++ class and other elements.

The following table shows how C/C++ elements map to UML elements and stereotypes with icons in class diagrams.

C/C++ element UML element Stereotype Icon
Header File Artifact <<header file>> The image shows a C/C++ header file icon.
Source Code File Artifact <<file>> The image shows a C/C++ source code file icon.
Folder Artifact <<folder>> The image shows a C/C++ folder icon.
Class Class <<class>> The image shows a C/C++ class icon.
Enum Enumeration <<enum>> The image shows a C/C++ enumeration icon.
Struct Class <<struct>> The image shows a C/C++ struct icon.
Typedef Class <<typedef>> The image shows a C/C++ typedef icon.
Union Class <<union>> The image shows a C/C++ union icon.
Namespace Package <<namespace>> The image shows a C/C++ namespace icon.
Global element Class <<global>> The image shows a C/C++ global element icon.
Non-member function Class <<global>> The image shows a C/C++ non-member function icon.
Non-member variable Class <<global>> The image shows a C/C++ non-member variable icon.
Class member field Attribute (public, protected, private) <<attribute>> The image shows a C/C++ public attribute icon.The image shows a C/C++ protected attribute icon.The image shows a C/C++ private attribute icon.
Class member method Operation (public, protected, private) <<operation>> The image shows a C/C++ public operation icon.The image shows a C/C++ protected operation icon.The image shows a C/C++ private operation icon.
Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.