Visibility in domain modeling class diagrams

In domain modeling 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.

The following table illustrates how different levels of visibilities are represented for attributes and operations with visibility icons or text symbols in class diagrams.

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.

Feedback