In class diagrams, an attribute represents a data definition for an instance of a classifier. An attribute describes a range of values for that data definition.
A classifier can have any number of attributes or none at all. Attributes describe the structure and value of an instance of a class.
For example, one of the attributes that a "Customer" class has is a "balance" attribute that holds the amount of money in the customer's account.
In UML class diagrams, the following mappings exist:
Attributes are shown in the attribute compartment of a shape.
The following table shows attributes declared in source code and how they are illustrated in the Visualizer.
C/C++ source code | UML visualization |
You can show, hide, or collapse the attribute compartment, and
show or hide the compartment title. You can also specify the visibility
styles of attributes as text symbols (such as "-") or icons (such
as ).
Parent topic: Class diagrams and diagram elements
Related concepts
Classes
Class diagrams
Relationships
Operations
Multiplicity
Visibility
Related tasks
Changing the default for showing attribute and operation compartments