There is a certain class hierarchy and I would like to have another hierarchy having a class corresponding to every class in the former hierarchy. Note that the structure of the second hierarchy isn't as neat or as similar as the original hierarchy.
As an illustration, I have a Game
hierarchy that has different games like CricketGame
, TestCricketGame
, BasketBallGame
etc., and there must exist a CricketGamesContainer
, TestCricketGamesContainer
and BasketBallGamesContainer
in the other hierarchy. Is there a way of ensuring that for every class in the Game
hierarchy the programmer is forced to write a class in the Container
hierarchy? That is, say, the code doesn't compile otherwise.