Let’s say I have BaseA
and BaseB
classes. BaseB
can have to several references of BaseA
instances. Now, we have two other classes, DerivedA
and DerivedB
that respectively inherit from BaseA
and BaseB
.
How can I show in such a diagram that DerivedB
should only store instances of DerivedA
and not instances of BaseA
? It seemed pretty simple before I tried to draw it, but now I’m confused. One obvious answer would be “redesign your code”; if there is no alternative, I will probably try to do so.
4