An attribute declaration in a class, which takes the following form, declares one or more attributes of the class:
attribute Type AttributeDeclarator, ..., AttributeDeclarator;where the Type must be one of the following: int, float, boolean, String, Color, and Font
Identifier Identifier in Domain Identifier R expressionwhere Domain is an interval
The following shows three examples:
attribute int width == rect.width; attribute Color color in {red,black,white}; attribute int x in 0..9;The first one declares an attribute, named width, and constrains it to be the same as rect.width where rect must be a component declared in the same class. The other two examples declare two attribute variables and specify their domains.