Parameterized Classes (Templates)

Return to Introduction  Previous page  Next page

Enterprise Architect supports template or parameterized Classes, which specify parameters that must be defined by any binding Class. A template Class enables its functionality to be reused by any bound Class. If a default value is specified for a parameter, and a binding Class doesn't provide a value for that parameter, the default is used. Parameterized Classes are commonly implemented in C++.

Enterprise Architect imports and generates templated Classes for C++. Template Classes are shown with the parameters in a dashed outline box in the upper right corner of a class.

To create a parameterized Class, follow the steps below:

1.Display the Property dialog for a class.
2.Select the Detail tab.
3.In the Type field, click on the drop-down arrow and select Parameterized.
4.Click on the Add button and define the required parameters in the Class Parameter dialog.

Notation Example

Example of a Parameterized Class

OMG UML Specification

The OMG UML specification (UML Superstructure Specification, v2.1.1, p. 620) states:

"A template is a parameterized element that can be used to generate other model elements using TemplateBinding relationships. The template parameters for the template signature specify the formal parameters that will be substituted by actual parameters (or the default) in a binding. "