How to represent a static relationship in an UML class diagram

China☆狼群 提交于 2020-01-24 07:30:11

问题


I'm having trouble finding a good answer for how to represent a relationship between two classes A and B, where an instance of A is a static (class scope) variable in B. For example:

class A {

}

class B {
    static A a;
}

I'm not even sure if it is a regular association or a dependency (or something else?).

One idea would be to use a stereotype on the role name of A in the relationship, but I have never seen that done. And since I understand that it is 'rule' not to use both an attribute and a relationship to represent the same member I can't either underline an attribute called 'a' (since I rather want to model the contents of the class A).


回答1:


Just use a stereotype <<static>> to model static relationships or attributes



来源:https://stackoverflow.com/questions/21487778/how-to-represent-a-static-relationship-in-an-uml-class-diagram

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!