简体   繁体   English

如何在 Java UML 类图中显示包含其他类的抽象类?

[英]How to show abstract class containing other classes in Java UML class diagrams?

Looking for clarification on how to draw the arrows for an abstract class which contains private variables of a different class type (ie non-primitive variables).寻找有关如何为包含不同类类型的私有变量(即非原始变量)的抽象类绘制箭头的说明。 I've got this as an example and was not sure if correct.我以这个为例,不确定是否正确。

Image:图片:我在这里做的例子

Is this correct?这个对吗?

Rather than Realization which is meant more for interface realization you should use simple Generalization with a solid line instead.而不是更多地用于接口Realization的实现,您应该使用带有实线的简单Generalization This is about inheritance where the concrete inherit from the abstract classes.这是关于从抽象类继承的具体继承。 This means also that the association is inherited which for a realization would not be the case.这也意味着关联是继承的,对于实现而言,情况并非如此。

Since Christophe mentioned it: There is no need to repeat operations/attributes in the inheriting class.既然Christophe提到它:继承类中不需要重复操作/属性。 See pp. 100 of UML 2.5:参见 UML 2.5 的第 100 页:

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.由分类器继承的成员可以显示在该分类器的图表上,方法是在该成员未被继承的情况下将显示的文本表示前加一个插入符号“^”符号。 [...] 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.符合要求的实现不需要提供此选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM