Equivalence between C++ source code and the UML model

 

Basic types

 

C++ type

UML type

Tagged value

Char

char

 

Bool

boolean

 

Short

int

{short}

Int

int

 

Long

int

{long}

Signed

int

 

Unsigned

int

{unsigned}

Unsigned short

int

{short} {unsigned}

Unsigned char

char

{unsigned}

Float

real

 

Double

real

{long}

Void*

undefined

 

Qualifier volatile

 

{volatile}

Qualifier const

 

{const}

Qualifier mutable

 

{mutable}

 

 

Qualifiers

 

C++ element

UML element

Tagged values

Class

Class

 

Enumeration

Enumerated type

 

Enumeration elements

Enumeration Literal

 

Structure

Primitive class

{struct}

Union

Primitive class

{union} 

 

 

Namespaces

 

C++ element

UML element

Namespace definition

Package

Namespace alias

Reference on a package

Namespace use (using)

Use link on the class associated with the file

Namespace element use

Textual note on the class associated with the file

 

 

Inheritance

 

C++ element

UML element

Tagged values

Inheritance

Generalization

{private}

Public inheritance

Generalization

 

Protected inheritance

Generalization

{protected}

Private inheritance

Generalization

{private}

Virtual inheritance

Generalization

{virtual}

 

 

Class member attributes

 

Type of the C++ member attribute

UML element

Tagged value

Multiplicity

Simple type

Attribute

 

1

Primitive class

Attribute

 

1

Defined or enumerated type member

Attribute

 

1

Non primitive class

Association role

Composition

 

1

Pointer on char

String type attribute

 

1

Pointer on simple type

Attribute

{*}

0..1

Primitive class pointer

Attribute

{*}

0..1

Defined or enumerated type pointer

Attribute

{*}

0..1

Non primitive class pointer

Association role

 

*

Reference on simple type

Attribute

{&}

1

Primitive class reference

Attribute

{&}

1

Defined or enumerated type reference

Attribute

{&}

1

Non primitive class reference

Association role

 

1

Function pointer

Attribute with a C++TypeExpr note

 

1

Member pointer

Attribute with a C++TypeExpr note

 

1

Attribute member of table [n] of simple type

Attribute

 

multiplicity n

Attribute member of table [n] of primitive class

Attribute

 

multiplicity n

Attribute member of table [n] of enumerated or defined type

Attribute

 

multiplicity n

Attribute member of table [n] of non primitive class

Association role

 

multiplicity n

 

 

Member functions

 

C++ element

UML element

Tagged values

Member function

Operation

 

Virtual member function

Operation

{virtual}

Pure virtual member function

Abstract operation

 

Inline member function

Operation

{inline}

Constructor

<<create>> operation

 

Destructor

<<destroy>> operation

 

Static member function

Class operation

 

Const member function

Operation whose passing mode is in

 

 

 

Function parameters

 

C++ element

UML element

Tagged values

Parameter by value

In/out parameter

 

Parameter by reference

In/out parameter

{&}

Const parameter by reference

In parameter

{&}

Pointer parameter

In/out parameter

{*}

Char* parameter

String type in/out parameter

 

Ellipsis

Not translated

 

Parameter default value

Default value

 

 

 

Function return parameters

 

C++ element

UML element

Tagged values

Void

No return parameter

 

No return indicated

"int" type return parameter

 

Return by value

Corresponding type return parameter

 

Return by reference

Corresponding type return parameter

{&}

Return by pointer

Corresponding type return parameter

{*}

 

 

Declarations and definitions of variables not linked to a class

 

C++ element

UML element

Tagged values

Declaration of global variable

Class attribute

 

Declaration of external variable

Class attribute {extern}

 

Declaration of global variable

Class attribute

 

Declaration of static variable

Private class attribute

 

 

 

Declarations and definitions of functions not linked to a class

 

C++ element

UML element

Non static global function

Class operation

 

 

Friendship declarations

 

C++ element

UML element

Friend function declaration

No translation

Friend class declaration

No translation

 

 

Templates

 

C++ elements

UML elements

Tagged values

Template class

Class + template parameter

 

Template operation

Operation + template parameter

 

Template static instantiation

Typedef

 

Template dynamic instantiation

Type of an attribute or operation parameter

 

 

 

Other constructors

 

C++

UML

Defined on

#include

C++BodyHeader or C++InterfaceHeader note

Classes associated with the file

#define

No translation

 

Compilation directives

No translation

 

Directory structuring

Package