1
How to represent in the class UML when a method should be overwritten?
If it is enough just to repeat the parent class method for the daughter class or there is another way or, who knows, it should not (although I find this impractical)?
1
How to represent in the class UML when a method should be overwritten?
If it is enough just to repeat the parent class method for the daughter class or there is another way or, who knows, it should not (although I find this impractical)?
1
There is no universally correct form, what I see is more common to do is to place an abstract method as italic in the original class, making it clear that it must be superscripted by whoever inherits the class. For coherence the class name should also be in italics since it is obviously abstract too.
As there is an implementation, you must repeat the method in the child class. I have seen some controversies about this, especially when it does not inherit from an abstract method and only overlaps with what already exists. But to repeat it seems more logical. The omission should only occur when the upper class method is used without new implementation, which is obviously impossible if the method is abstract.
Some people like to wear <<abstract>>
above the class name. It may be a good one to visually make more explicit that the class is abstract. In the method it would be visual pollution but some use <<virtual>>
in the upper class method and <<override>>
in the method that will receive the (new) implementation.
But note that all this I’m talking about is in general terms. Some UML software requires a certain pattern, especially if it generates source code from the class diagram.
Browser other questions tagged oop uml
You are not signed in. Login or sign up in order to post.
Thank you so much again @bigown, you have help me a lot.
– Leandro Macedo
Now it’s clearer!!
– Leandro Macedo
In fact, there is a universally correct form. A specification UML 2.5 defines the following: "The name of an Abstract Classifier is Shown in italics, Where permitted by the font in use. Alternatively or in addition, an Abstract Classifier may be Shown using the textual Annotation {Abstract} after or Below its name."
– dcastro
@dcastro thanks for the link was looking for a post reference to show how it is specified.
– Maniero