jeudi 20 juin 2019

Design Pattern for a very long base class

If I have 8 long methods that will be shared among 4 child classes (not all of them will be using all the methods) some will be use only 2 others 4, etc.

If I create a base class and each of the 4 child classes inherit from the base class then the problem is solved but I am trying to avoid using a very long base class.

I can try to divide the base class in more classes depending on how they are used and then use multiple inheritance, this is another solution.

Is there any other pattern to solve this problem?? What would be the optimal?

Aucun commentaire:

Enregistrer un commentaire