是否存在用于在UML静态类图中显示重写方法的约定? [英] Is there a convention for showing overridden methods in UML static class diagrams?

查看:345
本文介绍了是否存在用于在UML静态类图中显示重写方法的约定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果类Human继承自超类Mammal的某些方法(例如laysEggs: () -> false)并覆盖其他方法(例如postsToStackOverflow : () -> true),则在部分中指示不同方法的方式之间是否有区别Human的UML静态类图?例如,是否仅在Human框中显示了被覆盖的方法,或者同时显示了这两个方法,并为该被覆盖的方法添加了一些注释?

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?

推荐答案

现在有.一些匿名者让我深入研究了 2.5.1.规格.在第100表示​​

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>

除了p上的图9.11之外,规范本身(尚未)也没有过多地使用脱字符号.第113页的图10.9. 171.

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

在2.5的规格中,答案是:不,没有.您只能通过检查继承自该类的方法来判断方法已被覆盖.

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.

这篇关于是否存在用于在UML静态类图中显示重写方法的约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆