Search code examples
umlclass-diagrammultiplicity

Two to one multiplicity? - UML Class Diagram


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:

Class diagram example

Hope the question makes sense.

Thanks in advance.


Solution

  • 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