Chapter 3 Building Structural Diagrams
Overriding an operation inherited from a parent class
The Inherited Operations dialog box allows you to:
- View the operations inherited from the parent classes or interfaces
- Override an operation
Within the context of an inheritance, you can add to a class an operation that belongs to a parent class, this is called overriding. The operation of the parent class is said to be overriden when this operation is redefined in a child class.
The new operation has the same signature (name and parameters) as the original operation. Once you add an operation to a class, you can only modify the code implementation of the operation. You cannot modify the signature of the operation.
To add an inherited operation to a class:
- Double-click a class that is linked to a parent class in the diagram, and then click the Operations tab.
- Click the Inherited button to open the Inherited Operations window. This window lists all the operations that belong to all the parent classes of the class.
- Select an operation, then click Override and Close to copy the operation to the list of operations of the child class. The copied operation is grayed, indicating that its properties cannot be modified, and its stereotype is set to <<Override>>.
- Click OK in each of the dialog boxes.
Copyright (C) 2006. Sybase Inc. All rights reserved.
|
|