How can i make a relationship in a class diagram one-to one?

Support

How can I make a relationship in a diagram one-to-one?

How can I make a relationship in a diagram one-to-many?

Do the instructions your about to give me also apply to subclasses and superclasses? If they don't how do I make them apply to superclasses and subclasses?

19 March 2018 17:11:52 Yoseph

Add Comment

Dusan Rodina - softwareideas.net 19 March 2018 17:35:05

If you have two class elements A and B. You can connect them with composition or aggregation relationship. (The difference between composition and aggregation is described here: www.softwareideas.net/a/210/Class-Diagram--UML- )

For one-to-one relationship set the multiplicity as 1 for both roles (ends).

For one-to-many relationship set the multiplicity as 1 for one role (end) and as * for second role (end). You can edit multiplicities directly in the diagram - select a relationship and then click (or double-click) on the top (left or right) blue rectangle over the relationship line. You can type the custom value for multiplicity or you can just choose it from the drop down list.

Dusan Rodina - softwareideas.net 19 March 2018 17:37:11

Defined relationships are inherited for subclasses, but not for superclasses.