samedi 20 avril 2019

Template design pattern - how to "share" implementations?

Working on a project so I'll try to generalize this.

Say I have an abstract class A with an abstract method method().

There are 4 subclasses of A: B, C, D, and E, but B and C have the same exact implementation of method(), and D and E have the same exact implementation of method(). How can I organize the code in such a way that minimizes duplicate code?

Aucun commentaire:

Enregistrer un commentaire