Class (as specialized)

A class describes a set of objects that share the same specifications of features, constraints, and semantics.
Constructs::Class merges the definition of Basic::Class with Constructs::Classifier.

Description

Class is a kind of classifier whose features are attributes and operations. Attributes of a class are represented by instances
of Property that are owned by the class. Some of these attributes may represent the navigable ends of binary associations.

Attributes

Associations

ownedAttribute : Property [*] The attributes (i.e. the properties) owned by the class. This is an ordered association. Sub-
sets Classifier::attribute and Namespace::ownedMember.
ownedOperation : Operation [*]The operations owned by the class. This is an ordered association. Subsets Classi-
fier::feature and Namespace::ownedMember.
superClass : Class [*] This gives the superclasses of a class. It redefines Classifier::general.

Constraints

No additional constraints.

Additional Operations

  1. The inherit operation is overridden to exclude redefined properties.

    Class::inherit(inhs: Set(NamedElement)) : Set(NamedElement);
    inherit = inhs->excluding(inh |
    ownedMember->select(oclIsKindOf(RedefinableElement))->select(redefinedElement->includes(inh)))

Semantics

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.

Notation

A class is shown using the classifier symbol. As class is the most widely used classifier, the word "class" need not be
shown in guillemets above the name. A classifier symbol without a metaclass shown in guillemets indicates a class.

Presentation Options

A class is often shown with three compartments. The middle compartment holds a list of attributes while the bottom
compartment holds a list of operations.

Attributes or operations may be presented grouped by visibility. A visibility keyword or symbol can then be given once
for multiple features with the same visibility.

Additional compartments may be supplied to show other details, such as constraints, or to divide features.

Style Guidelines

Examples