ibm Rational Rhapsody 7.5 — Creating a template class

Template classes and generic classes 5. Accept the default type or select another one from the Kind list. 6. To add arguments for the template, click the Invoke Features window button to open the Template Argument window. Note the following for the Template Argument window: a. If you select the Use existing type check box, you can change the type and enter a description. In C++, you can also provide a default value for the template argument. b. If you clear the Use existing type check box, you can enter code that further refines the argument type, for example a pointer to a type or an array of a certain type.

When entering code in the C++[Java] Declaration box, you can also see other arguments that have been defined. c. Click OK to close the Template Argument window and return to the Template Parameters tab. 7. Add more templates as needed by clicking on the Template Parameters tab. 8. To determine the argument order on the Template Parameters tab, use the Move Item Up and Move Item Down buttons. 9. If there is a primary template that you want to use, select it in the Primary Template drop-down list box. This box contains templates for which this class is a specialization. Its parameters to be instantiated appear in the box below the Primary Template drop-down list box.

You can define specialization parameters only if you select a template as a primary class. Note: When you try to delete a template that has specialization, Rational Rhapsody warns you that the template has references. If you do delete the template, such specialization will generate an error when you check a model. Rational Rhapsody 123