Is there a convention for showing overridden methods in UML static class diagrams?

后端 未结 3 1480
囚心锁ツ
囚心锁ツ 2020-12-31 03:13

If class Human inherits some methods from superclass Mammal unchanged (such as laysEggs: () -> false) and overrides other methods (

相关标签:
3条回答
  • 2020-12-31 03:33

    Now there is. Some anonymous got me to dig into the 2.5.1. specs. On p. 100 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>

    The specs itself does not (yet) make much use of the caret notation except for figure 9.11 on p. 113 and figure 10.9 on p. 171.

    Note that this is only valid for properties/connectors and not for operations. See also this related question


    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.

    0 讨论(0)
  • 2020-12-31 03:35

    Though not specified in the UML standard, following is a notation understood to indicate when one function overrides another:

    + toString() : String <<override>>
    
    0 讨论(0)
  • 2020-12-31 03:50

    I duplicate method declaration, if I want to show that inherited class will override it, in other case just omit declaration.

    0 讨论(0)
提交回复
热议问题