Visibility

In Unified Modeling Language (UML) visualization class diagrams, visibility defines whether attributes and operations of specific classes can be seen and used by other classes.

For example, the attributes and operations in a class with public visibility can be seen and used by other classes, while the attributes and operations with private visibility can be seen and used only by the class that contains them.

You can use decoration icons or text symbols to show the level of visibility for attributes and operations. A text symbol appended to the name of an association end shows the visibility of that association end.

Visibility level Icon for attribute Icon for operation Text symbol Description
Private

The image shows an Eclipse Private visibility decoration icon for attributes.

The image shows an Eclipse Private visibility decoration icon for operations.

- Only classes in the same container can see and use the classes.
Protected

The image shows an Eclipse Protected visibility decoration icon for attributes.

The image shows an Eclipse Protected visibility decoration icon for operations.

# Only classes in the same container or a descendent of the container can see and use the classes.
Public

The image shows an Eclipse Public visibility decoration icon for attributes.

The image showis an Eclipse Public visibility decoration icon for operations.

+ Any class that can see the container can also see and use the classes.
Package

The image shows an Eclipse Package visibility decoration icon for attributes.

The image shows an Eclipse Package visibility decoration icon for operations.

~ Only classes within the same package as the container can see and use the classes.

 

Parent topic

About UML class diagrams

 

Related concepts

Class diagrams
Class shapes
Classifiers
Classes
Relationships
Attributes
Operations
Adornments for unresolved references
Multiplicity

 

Related tasks

Changing the default visibility style for attributes and operations
Specifying the visibility style for attributes and operations