Search code examples
inheritanceumlcompositionclass-diagram

I cant find the fault in this UML Class diagram


UMLclassdiagramm

This UML diagram has exactly one fault but I am not sure what it is.
My guess is that B cant be a part of A because its the superclass of C.

Anyone got a solution?


Solution

  • If C is a specialisation of B, it inherits also it’s associations. This implies that any instance of C is a component of an instance of A in addition of being a component of an instance of D (because of the multiplicity of 1..1): this is in contradiction with UML composition which requires an exclusive ownership.

    You may get a valid diagram for example by removing inheritance, by changing the multiplicity next to roleA to 0..1, or by using aggregation instead of composition on the side of A.