So, you have an interface and an abstract class that implements a subset of the methods in the interface. You also have some classes that inherit from an abstract class and provide implementations of methods that an abstract class does not.
So what is the best thing here? I am talking about issues such as:
1) Should an abstract class implement an interface or its child classes? Do each class have to? It seems to me that only an abstract class should. Of course, all classes could implement the interface, but this seems superfluous because the children of the abstract will "inherit" the interface, because they extend the abstract class.
2) Given that an abstract class implements parts of an interface, should it also declare abstract methods for methods that it does not implement? It seems to me that this is correct, but in some ways it seems unnecessary, because abstract children will have to implement these methods for compilation.
So what are your arguments for best practice? The question comes down to the following: we have an interface that determines what we want from some classes, we have a subset of the methods in the interface that define general behavior, and we have several different ways to define non-general behavior. What is the best way to do this?
John M Naglick
source share