ibm Rational Rhapsody 7.5 — Instantiating a template class

Template classes and generic classes Creating a functions template To create a functions template: 1. Create a function and open its Features window. 2. On the General tab, select the Template check box. Notice that the Template Parameters tab displays. 3. Set your template parameters for your function on the Template Parameters tab. For detailed instructions, see Creating a template class . Once you have created the template operation you can begin using it in your code. Instantiating a template class To instantiate a template class: 1. Create a class in an OMD, or in the Rational Rhapsody browser. 2. Open the Features window for the class. 3.

On the General tab, in the Class Type area, select the Instantiation radio button. Notice that the Template Instantiation tab displays. 4. On the Template Instantiation tab, select a template from the Template Name drop-down list box. 5. To view/modify the parameters for a template, double-click the template name or click the Invoke Features window button to open the Template Instantiation Argument window. Click OK to return to the Template Instantiation tab. When code is generated, the template instantiation is represented by a typedef in C++ and by a class in Java. Rational Rhapsody 125