Reputation: 1075
I was creating a class diagram and I realised I wasn't certain about multiplicity.
If a class holds two objects of another type of class does that make the multiplicity 2 to 1 or just 1 to 1?
Example:
Hope the question makes sense.
Thanks in advance.
Upvotes: 2
Views: 2994
Reputation: 31
We can suppose that class Customer has 2 fields to navigate to two instances of class Address. These navigations have different semantics and maybe different purposes. So we should to use two assotiations with multiplicities of "0..1 - 1" or "1 - 1".
Upvotes: 0
Reputation: 906
With multiplicities, you simply set all possible alternatives. For example, if your Customer can have either one or two Addresses, then it's 1..2
. If a Customer can have either no address or 1 or 2 addresses, then it's 0..2
and so on
Upvotes: 4