- the containers should be unrelated through inheritance, or
- the elements should be related through inheritance.
In other words, my elements do not follow the principle of substitutability of objects that are related through inheritence, but their containers do, apart from a single method addelement() which adds the disparate elements to the containers.
What would be a good solution to this dilemma? Has anyone come across such a situation before?
(I originally posted this question as part of a larger question in this thread which which did not attract many responses, so I'm splitting up my question into different parts and skipping implementation details as suggested there.)