UML 类图:对实例的引用? [英] UML class diagrams: References to instances?

查看:46
本文介绍了UML 类图:对实例的引用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的类图中的某些类需要引用其他类或它们自身的特定实例.我应该像在对象图中那样建模还是有更好的选择?一般而言:可以将类图和对象图结合起来吗,因为对象图本身就是类图?

Some classes in my class diagram need to reference specific instances of other classes or themselves. Should I just model those the same way i would in an object diagram or is there a better option? In general: Can one combine class and object diagrams, since object diagrams are themselves class diagrams?

谢谢!

推荐答案

UML2引入Composite Structure Diagram正是为了解决这个问题.

UML2 introduced Composite Structure Diagram exactly to solve this issue.

在复合结构图中,您可以根据实例显示分类器(例如类)及其内部组成.

In a Composite Structure Diagram you can show classifiers (e.g. Classes) together with theirs internal composition in terms of instances.

通过这种方式,您可以准确指定哪些实例链接到您的对象.

This way you can specify exactly which instances are linked to your objects.

请参阅这篇文章以获得很好的解释.

See this article for a good explanation.

这篇关于UML 类图:对实例的引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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