ibm Rational Rhapsody 7.5 — Using objects

Model elements Using functions The Functions category lists global functions, which are visible to all classes in the same package. Creating a global function 1. Right-click the name of a package or the Functions category in the browser. 2. Select Add New > Function . A new function displays under the Functions category of the selected package. 3. Edit the name of the new function in the browser. Changing what a function returns When a function returns an «existing type», it is returned by type pointer. You can set if the function returns by "value"() , by "pointer"(*) or by "reference"(&) . To change what a function returns: 1.

Right-click the function/operation and choose Features to open the Features window. 2. On the Properties tab, find the CPP_CG::Type::ReturnType property. 3. Change the value to any of the following choices: $Type* to return by "pointer"(*) $Type to return by "value"() $Type& to return by "reference"(&) 4. Click OK . Using objects Objects are instances of classes in the model and can be used by any class. They are typically created in OMDs, but can be added from the browser. For instructions on creating an object in an OMD, see Object model diagrams . To create an object 1. Right-click the name of a package or the Objects category in the browser. 2. Select Add New > Object .

The new object is displayed in the browser with the default name object_n . 3. Optionally, rename the new object. 318 User Guide