如何在类图上将属性的数据类型表示为对象数组? [英] How to represent an attribute's data type as an array of objects on class diagram?

查看:494
本文介绍了如何在类图上将属性的数据类型表示为对象数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪种方法正确显示属性的数据类型是对象数组?我在网上找到了两个不同的版本.

Which way is the right one to show that an attribute's data type is an array of objects? I have found two different versions online.

我有SportsCentre班,也有Employee班

I have a SportsCentre class and I also have an Employee class

推荐答案

两种方法都是正确的,但是第二种方法(当将多重性设置为一个以上时使用)更为自然,因此不必将集合类定义为它显示在您的示例的第一张图片上. 简而言之,多重性定义了按属性可以存储多少个特定类型的实例.这组实例可以排序,也可以允许重复.多重元素的参数会影响应使用的集合类型,集合,向量,数组等. 但是,如果您需要有关此问题的准确信息,请阅读UML Superstructure.搜索属性和多重性元素. 这是UML网站

Both are correct, but the second one, when multiplicity is set to more than one is used is more natural, and it is not necessary do define collection class as it is shown on the first picture of your example. Simply said, multiplicity defines how many instances of specific type can be stored by attribute. This set of instance can be ordered or duplicates in it may be allowed. Parameters of multiplicity element have impact on type of collection which should be used, Set, Vector, Array etc. But, if you need precise info about this issue, read UML Superstructure. Search for Property and Multiplicity Element. here is UML website

这篇关于如何在类图上将属性的数据类型表示为对象数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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