uml 中的覆盖方法 [英] Override method in uml

查看:60
本文介绍了uml 中的覆盖方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建 UML 图.例如,我有一个带有方法 a() 的类 A 和扩展 A 并覆盖方法 a() 的类 B.是否有任何标准来指示 UML 中的重写方法?

解决方案

如该答案所示

B 不会覆盖 oper

但是有:

我们无法知道,除非我们确定 ^ 始终如上图所示在模型中使用

请注意,在该句子中,规范使用了两次 member(而不是 properties),并且 Class 继承(间接)分类器,以便适用于操作.

正如在另一个答案中注意到的,规范也说:

<块引用>

继承的成员也可以以较浅的颜色显示,以帮助将他们与非继承的**成员*区分开来.

又是两次members而不是properties,而且他们使用的事实清楚地表明还有另一种方式^.所以两个一致的句子表示 ^ 适用于操作

[警告]

我使用了 BoUML 来制作图表,首先你可以看到^oper()"但是我欺骗"了将相应的操作命名为^oper",没有选项可以在图表中显示 ^ 以指示操作或其他成员被继承

I am trying to create UML diagram. For example I have a class A with method a() and class B that extends A and overrides method a(). Is there any standard to indicate overridden methods in UML?

解决方案

As indicated in that answer https://stackoverflow.com/a/28932482/2458991 there is a specific indicator to indicate a member (for instance an operation) is inherited, but that indicator is not mandatory, the norm 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.

So, having :

B does not override oper

But having :

we cannot know except if we are sure the ^ is always used in the model as in previous diagram

[edit]

Notice the norm use two times the words member (and not properties) in that sentence, and Class inherits (indirectly) Classifier, so that applies for operations.

As noticed in an other answer the norm says also :

Inherited members may also be shown in a lighter color to help distinguish them from non-inherited **members*.

so again two times members rather than properties, and the fact they use also clearly reference the fact there is an other way which is the ^. So two consistent sentences indicating ^ applies to operations

[warning]

I used BoUML to make the diagrams and in the first you can see "^oper()" but I 'cheated' to do that naming the corresponding operation "^oper", there is no option to show a ^ in a diagram to indicate an operation or other member is inherited

这篇关于uml 中的覆盖方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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