So I have an association class C that is an association between classes A and B. Class D is a subclass of class C as it contains data from class C. Is it possible? and can it be represented as a diagram? If yes then how can I associate class D with class A and B too since class D is also an association class to classes A and B?
CodePudding user response:
Yes it is allowed. It is also allowed to have a second association, between class D and A or class D and B. Two classes may have multiple relationships with each other.
Example: A = Person, B = Team, C = Membership, D = Leadership, then D can have association 'assists' between Person and Leadership.
CodePudding user response:
If, as you say, Class D
is an AssociationClass as well, it is possible.
However, a simple Class cannot be a subclass of an AssociationClass.
Where is the problem representing this in a diagram? Simply show the Generalization between the two AssociationClasses. Please note, since Associations are Classifiers, even simple Associations can have a Generalization.
One problem is, that the AssociationEnds of D
will be separate attributes. You want them to be the same attributes as the ends of C
. The only way to achieve this, as far as I can see, is to make them subsets, and derive them.