UML Class Relationships

后端 未结 6 592
旧巷少年郎
旧巷少年郎 2021-01-14 11:41

I would like to confirm whether I am on the right track when identifying common UML class relationships. For example, is the relationship between:

1

6条回答
  •  时光取名叫无心
    2021-01-14 12:33

    The convention that I use to remember which is which is that an composite relationship means that contained instances can't exist without it's enclosing type whereas in an aggregate relationship, objects can exist without the enclosing type As an example:

    • A Car 'has' 4.Wheels (aggregation)

    • A Cars Vehicle Identity Number is 'part of' a Car (composition)

    (Rubbish example, but the best I could bring to mind :)

提交回复
热议问题