I have the following basic design points:
Let's say I need to design 2 entities, ADecoder and BDecoder, which are almost the same, except for few details.
Let's say both have a function decode() which of course would be separate in what they do, and there are some other functions as well, with the same characteristic, in that they perform entirely distinct operations based on the decoder type.
And of course, there are many functions which have the exactly same functionality i.e. are agnostic to what type of decoder it is.
Now should I design only one class and operate on its instances based on their properties, decide what to do in the similar functions and leave the code for the core functions to be the same (entailing switch/if else etc.) ?
Or should I design an abstract base class, and implement the common functions in it and leave the virtual functions to be decided by the respective child classes ?
Or is there some other method that would be more apt for this kind of problem ?