C/C++ domain modeling 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>> | |
| Source Code File | Artifact | <<file>> | |
| Folder | Artifact | <<folder>> | |
| Class | Class | <<class>> | |
| Enum | Enumeration | <<enum>> | |
| Struct | Class | <<struct>> | |
| Typedef | Class | <<typedef>> | |
| Union | Class | <<union>> | |
| Namespace | Package | <<namespace>> | |
| Global element | Class | <<global>> | |
| Non-member function | Class | <<global>> | |
| Non-member variable | Class | <<global>> | |
| Class member field | Attribute (public, protected, private) | <<attribute>> | |
| Class member method | Operation (public, protected, private) | <<operation>> |