UML类图:这算怎么写抽象方法和属性? [英] UML class diagram: is this how to write abstract method and property?
问题描述
当我创建了第一次小C#项目的UML类图我遇到了一些麻烦的属性。最后我刚才添加的属性与℃的变量;<性>>
在开始。现在,我想知道我怎么用一个抽象方法解决这个问题?如果我只是添加<<&抽象GT;>
来该方法的罚款?林做这样的事情:
When I was creating the first time an uml class diagram for a small C# project I had some trouble with the properties. At the end I just added the properties as a variable with <<property>>
at the start. Now Im wondering how do I solve this with an abstract method? Should I just add <<abstract>>
to the method an fine? Im doing something like this:
-----------------------------------
| <<abstract>> |
| MyClass |
-----------------------------------
|<<property>> + a : int |
|<<property>> + b : string |
-----------------------------------
|<<abstract>> # Job() : void |
|<<abstract>> # Job2() : string |
|- SomeNonAbstractMethod() : void |
-----------------------------------
这是好吗?有什么建议?
Is this alright? Any suggestions?
推荐答案
每一个属性,实际上是在UML2一个属性。抽象方法是由斜体文本(UML有这个布尔值)显示出来。
Every "attribute" is actually a Property in UML2. Abstract methods are displayed by italic text (UML has a boolean value for this).
您正在使用的符号称为关键字(简单的方法)或刻板印象(更复杂) 。如果你想标记属性作为某种特殊那很好用关键字像你这样。
The notation you are using is called Keyword (simple way) or Stereotype (more complex). If you want to mark a Property as some kind of "special" that's fine with a keyword like you did.
这篇关于UML类图:这算怎么写抽象方法和属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!