Attributes

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
A snapshot of C/C++ source code attributes. C/C++ attributes are displayed.

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 The image shows an attribute visibility style icon.).

Related concepts
Class diagrams
Classes
Operations
Multiplicity
Visibility
Related tasks
Changing the default for showing attribute and operation compartments
Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.