| Level | Name | Description | Example |
|---|---|---|---|
| M2 | metamodel | UML Syntax | ![]() |
| M1 | model | UML Model | |
| M0 | data layer | Real World | ![]() |
+ public- private# protected~ package| Attribute Syntax | Description |
|---|---|
+name |
public name |
-name |
private name |
-name:Name |
private name of type Name |
-name:Name = "Project" |
private name of type Name with default "Project" |
-name:Name[3] |
private name of type Name with multiplicity of 3 |
-name:Name = "Project" { persistent } |
private name of type Name with the default "Project", and property 'persistent' |
| Operator Syntax | Description |
|---|---|
+draw() |
public operator draw() |
-draw() |
private operator draw() |
#draw() |
protected operator draw() |
+draw() : Boolean |
public operator draw() with return type Boolean |
+draw() : Boolean {optional} |
public operator draw() with return type Boolean, and a property optional |
| Parameter Syntax | Description |
|---|---|
+draw(: Shape) |
parameter of type Shape |
+draw(s: Shape) |
parameter s of type Shape |
+draw(in shape : Shape) |
in parameter shape of type Shape |
+draw(out picture : Picture) |
out parameter picture of type Picture |
+draw(inout picture : Picture) |
inout parameter picture of type Picture |
| C++ Declaration | UML Parameter Direction |
|---|---|
| Shape | in |
| const Shape& | in |
| const Shape* | in |
| Shape& | inout |
| Shape& | out |
| Shape* | inout |
| Shape* | out |
| Shape** | out (typical API usage) |
| Multiplicity Syntax | Description |
|---|---|
* |
Any number of values |
1 |
Single value (default) |
0..1 |
No more than a single value |
2..4 |
Two to four values |
| Multiplicity Term | Description |
|---|---|
| Optional | * |
| Mandatory | 1..* |
| Single-valued | 0..1 |
| Multivalued | 0..2, 0..* |
std::array, std::vector, std::deque, std::list, std::forward_liststd::optional (C++17)
And, IMHO, the UML standard started going off the rails when some started morphing it to be a programming language with formal semantics. Visual representations are, by their very nature, abstractions, not precise representations.