如何绘制具有相同 class 类型的多个字段的组合?

How to draw compositions of multiple fields that have the same class type?

如果标题不够清楚,请见谅。仅供参考,我正在尝试从 class 制作一个 UML 图。这是 class:

的片段
class ItemDisplay {
    Item currentItem;
    Item[] suggestedItems;
    Item[] randomlySelectedItems;
}

我要如何画出这个class的联想?我应该用相同的 class 绘制 3 个单独的关联还是只绘制一个但有很多重数?

谢谢。

你应该画出三个联想。

多重性是一个成员定义一个集合(数组,列表...)。

所以这里有两个具有多重性 0..*

这里有一些教程:

UML association multiplicity

UML Class Relationships

UML Association vs Aggregation vs Composition

UML Class Diagrams Reference

UML Class Diagrams: Guidelines

Defining Classes and Class Relationships

UML Tutotrial

The Unified Modeling Language Reference Manual