在UML中,是否必须展示抽象方法的具体实现?
我正在绘制一些 UML,其中一个具体类继承自一个定义纯虚拟方法的抽象类。 是否也需要在具体类中显示此方法? 这是通过从抽象类继承来暗示的。
I'm drawing some UML in which a concrete class inherits from an abstract class which defines a pure virtual method. Is it required to show this method in the concrete class as well? It's implied by inheriting from the abstract class.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,你不需要。 事实上,一般来说,不要在 UML 中添加任何超出您必须必须澄清的内容的内容,除非您(上帝禁止)尝试从中生成代码。
我所知道的最好的 UML 指南是 Martin Fowler 的 UML Distilled。
Nope, you don't need to. in fact, in general, don't put any more in the UML than you must have to clarify what you're saying, unless you're (god forbid) trying to generate code from it.
The best guide I know of for UML is UML Distilled by Martin Fowler.
UML 的有趣之处在于它有一个非常宽松且多样化的定义。 大多数称为 UML 的东西实际上只不过是框图。 任何 UML 实现都存在很多歧义。
我想说,如果您是为了演示或架构图而这样做,您可以用“单词”来解决很多可能的歧义。 如果您将使用某些应用程序从中生成代码,则应该检查该特定应用程序的文档。
The funny thing about UML is that it has a pretty loose and varied definition. Most things that are called UML are actually not much more that block diagrams. There is a lot of ambiguity in any UML implementation.
I would say that if you are doing this for a presentation or architectural diagram, you can take care of a lot of the possible ambiguity with 'words'. If you will be generating code from it using some application, you should check the docs of that particular application.
这是隐含的,事实上,当单击类查看其属性时,许多 CASE 工具会向您显示继承的方法作为子类方法列表的一部分(有些 CASE 工具甚至可以选择显示继承的方法)图中的方法)
It's implied and in fact, many CASE tools would show you the inherited method as part of the list of the methods of the subclass when clicking on the class at looking at its properties (and some CASE tools even have the option of showing also the inherited methods in the diagram)