How to represent an attribute's data type as an array of objects on class diagram?

Yiannis picture Yiannis · Dec 13, 2014 · Viewed 93.5k times · Source

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.

enter image description here

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

Answer

Vladimir picture Vladimir · Dec 13, 2014

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