Reputation: 11
I was wondering how we present a class that has both a "has-a" and "is-a" relationship with another class in a UML diagram.
I am wondering if this is correct:
Upvotes: 1
Views: 1144
Reputation: 6318
Simply use two relationships - one showing a generalization and a second showing association/shared aggregation/composite aggregation.
Below is an example with composite aggregation.
In case of association the method you suggested is an alternate notation having exactly the same semantics. You only need to use solid line not dashed for generalization as in my example. Dashed line depicts realization and points to an interface or any other specification that is implemented by class on the other end of realization arrow.
Upvotes: 1
Reputation: 36313
A realize relation is used to either an <<interface>>
or to an abstract class. So you would design it like this:
N.B.: The triangle from the realization must not overlap the class but touch it. Also there's likely a typo: seal
instead of sell
.
Upvotes: 2