What are the differences between an interface and an abstract class?
Some use a semantic distinction: an abstract superclass models the “is” relationship, while an interface models the “has” relationship. The rule would be, if it’s a subtype, inherit; otherwise, implement. But, in the absence of real-world characteristics to distinguish the objects from their properties and parents, that becomes a circular argument. In this case, you have to look at the practical differences in Java (compared with C++).
[*] Some use a semantic distinction: an abstract superclass models the “is” relationship, while an interface models the “has” relationship. The rule would be, if it’s a subtype, inherit; otherwise, implement. But, in the absence of real-world characteristics to distinguish the objects from their properties and parents, that becomes a circular argument. In this case, you have to look at the practical differences in Java (compared with C++). Most differences between interfaces and abstract classes stem from three characteristics: 1. Both define method signatures that a derived class will have. 2. An abstract class can also define a partial implementation. 3. A class can implement many interfaces, but inherit from only one class. In greater detail, these topics are: 1. Method signatures Both interfaces and abstract classes permit one to treat the derived-type class as the derived-from-type class. Both define a set of available methods in a way that can be enforced by the type-checking mec