How to represent in the UML class when a method should be overwritten?
If it is enough to just repeat the parent-class method for the child-class or is there another way, or who knows, maybe not (though I find this impractical)?
How to represent in the UML class when a method should be overwritten?
If it is enough to just repeat the parent-class method for the child-class or is there another way, or who knows, maybe not (though I find this impractical)?
There is no universally correct way, what I see that is more common to do is to put an abstract method as italic in the original class, making it clear that it should be overwritten by anyone who inherits the class. For consistency the class name should also be in italics since it is obviously abstract as well.
As there is an implementation, you must repeat the method in the child class. I've seen some controversy about this, especially when it does not inherit from an abstract method and only overlaps with what already exists. But repeating seems more logical. The omission should only occur when the upper-class method is used without re-implementation, which is obviously impossible if the method is abstract.
Some people like to use <<abstract>>
above the class name. It may be a good to make it visually more explicit that the class is abstract. In the method it would be visual pollution but some use <<virtual>>
na in the upper class method and <<override>>
in the method that will receive the (new) implementation.
But notice that all this that I am speaking is in general terms. Some UML softwares require a certain standard, especially if it generates source code from the class diagram.