If class Human
inherits some methods from superclass Mammal
unchanged (such as laysEggs: () -> false
) and overrides other methods (such as postsToStackOverflow : () -> true
), is there any difference between how the different methods are indicated in portion of the UML static class diagram for Human
? For example, are only the overridden methods shown in the box for Human
, or are both shown, with some annotation for the overridden methods?
UML notation allows you to specify overridden properties and operations. In many object-oriented programming languages, you can override a property or a method from the superclass. The overriding property/method in the subclass replaces the behavior of the property/method in the superclass.
The UML denotes static features by underlining the feature in the class diagram. Programmers translate the underlining to the static keyword when they translate the UML class diagram to C++. Denoting static features in a UML class diagram. The UML denotes static features by underlining them.
Object Diagram Object diagrams are a set of objects and their relationship is just like class diagrams. They also represent the static view of the system.
Static classes are usually denoted by underlining the class name. Its a convention to underline static features, so it makes sense that underlining the class name would denote a static class.
Now there is. Some anonymous got me to dig into the 2.5.1. specs. On p. 102 it says
Members that are inherited by a Classifier may be shown on a diagram of that Classifier by prepending a caret ’^’ symbol to the textual representation that would be shown if the member were not inherited. Thus the notation for an inherited Property is defined like this:
<inherited-property> ::= ’^’ <property>
where
<property>
is specified in 9.5.4.Similarly, the notation for an inherited Connector is defined like this:
<inherited-connector> ::= ’^’ <connector>
where
<connector>
is specified in 11.2.4.Analogous notations may be used for all NamedElements that are inheritedMembers of a Classifier to indicate that they are inherited.
Inherited members may also be shown in a lighter color to help distinguish them from non-inherited members. A conforming implementation does not need to provide this option.
Since it applies for NamedElements it can be used for attributes and operations as well.
The specs itself does not (yet) make much use of the caret notation except for figure 9.11 on p. 115 and figure 10.9 on p. 173.
In the specs for 2.5 and before the answer was: No, there isn't. You can only tell that a method is overridden by inspecting the methods of the class from which is inherited.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With