Creating constructors

Constructors are called when a class is instantiated.

Procedure

  1. Depending on if you want to use the Features window or the IBM® Rational® Rhapsody® browser:
    • On the Rational Rhapsody browser, double‑click a class to open its Features window and on the Operations tab, either click the <new> row in the list of operations or click the New button in the upper, right corner of the window and select Constructor.
    • On the Rational Rhapsody browser, right-click either the class or the Operations category under the class and select Add New > Constructor.
      Note: Alternatively, you can open this window by right-clicking the appropriate element in a diagram and selecting New Constructor.
  2. The Constructor Arguments window opens.
  3. Click Add. The Argument window opens.
  4. Type in a name for the new constructor and change the default values as necessary.
  5. Click OK twice.

Results

The new constructor is listed under the Operations category for the class in the Rational Rhapsody browser, as shown in the following figure:.Browser showing new constructor listed under the Operations category


Feedback