Method overriding is a very common technique in object-oriented programming. It allows developer deliver specific implementation of a method in the subclass although it already defined by the superclass. When overriding a method the subclass replace the implementation in superclass by providing a method which exactly same as the one in superclass, i.e same name, parameter and also the return type. In Visual Paradigm you don’t need to redefine the operation in subclass to model the override. You can simply do it in one click inside the specification dialog. To override the operation:
- Right click on the subclass and select Open Specification from the popup menu.
- Switch to Operations tab and select the operation from superclass (indicated in Classifier column) which you wish to override.
- Press the Override button and you will see the Classifier of the operation changed form superclass to subclass.
- Now the method is being overridden and show in the subclass.
- When perform code generation the method will also being generated into the subclass and waiting for you to fill in the custom implementations.