I have two classes (named MyFoo1
and MyFoo2
) that share some common functionality. So far, it does not seem like I need any polymorphic inheritance but, at this point, I am considering the following options:
- Have the common functionality in a utility class. Both of these classes call these methods from that utility class.
- Have an abstract class and implement common methods in that abstract class. Then, the
MyFoo1
andMyFoo2
classes will derive from that abstract class.
Any suggestion on what would be the best design decision?
Foo1
andFoo2
are in your question. i.e. it is not clear whether they are specialisations of the same thing. Can you tell us more about them?