Creating inheritances in object model diagrams

You can create inheritances (also known as generalizations) by using the Generalization arrow to draw a connection between two classes on a diagram. You can also create inheritances by using the Add New > Relations > Generalization command from the browser in IBM® Rational® Rhapsody®.

Procedure

To create inheritances among classes on a drawing:

  1. Click the Generalization button Generalization button, and then click in the subclass, for example, class B.
  2. Move the cursor and click in the superclass, for example, class A, to end the arrow.
  3. Create a generalization from, for example, class C to class A. Notice that by default, the lines appear in a tree style, as shown in the following figure:
    Generalization shown in tree style

    If you add another class to your diagram, for example, class D, you can add it to the tree structure by clicking the Generalization arrow from class D onto class A or onto a line on that tree.

    Note: If the line style for generalizations is not set to display in a tree style by default, to apply this line shape to two or more generalization lines pointing to the same target, select one of the generalization lines (for example, from class B to class A) and select Line Shape > Tree. You can also do this by targeting a generalization line to another generalization line that points to the same target. For example, if you have a generalization line from class B to class A, you can create a tree structure by touching the BA line with the generalization line from class C.

Results

The tree line shape is also available for realizations on object model diagrams and generalizations on use case diagrams.

For object model diagrams, the line shape for generalizations is set by the ObjectModelGe::Inheritance::line_style property and for realizations by the ObjectModelGe::Realization::line_style property.


Feedback