Return to Introduction  Previous page  Next page


A Class is a representation of objects that reflects their structure and behavior within the system. It is a template from which actual running instances are created. A Class can have attributes (data) and methods (operations or behavior). Classes can inherit characteristics from parent Classes and delegate behavior to other Classes. Class models usually describe the logical structure of the system and are the building blocks from which components are built.

The top section of a Class, as illustrated below, shows the attributes (or data elements) associated with a class. These hold the 'state' of an object at run-time. If the information is saved to a data store and can be reloaded, it is termed 'persistent'.  The lower section contains the class operations (or methods at run-time). Operations describe the behavior a Class offers to other classes, and the internal behavior it has (private methods).

Class elements are generally used in Class diagrams and Composite Structure diagrams.


Toolbox Icon


See Also

OMG UML Specification

The OMG UML specification (UML Superstructure Specification, v2.0, p. 87) states:

"The purpose of a class is to specify a classification of objects and to specify the features that characterize the structure and behavior of those objects. 

"Objects of a class must contain values for each attribute that is a member of that class, in accordance with the characteristics of the attribute, for example its type and multiplicity. 

"When an object is instantiated in a class, for every attribute of the class that has a specified default, if an initial value of the attribute is not specified explicitly for the instantiation, then the default value specification is evaluated to set the initial value of the attribute for the object. 

"Operations of a class can be invoked on an object, given a particular set of substitutions for the parameters of the operation. An operation invocation may cause changes to the values of the attributes of that object. It may also return a value as a result, where a result type for the operation has been defined. Operation invocations may also cause changes in value to the attributes of other objects that can be navigated to, directly or indirectly, from the object on which the operation is invoked, to its output parameters, to objects navigable from its parameters, or to other objects in the scope of the operation's execution. Operation invocations may also cause the creation and deletion of objects."