After touching the design pattern, both the interface and the abstract class will occasionally use the limit .. But I always think the difference between the two is very subtle,
As long as the object implementing this interface can appear in any place where this type is needed... No, it cannot be expressed ..
Anyway, it is almost like the object that implements the interface, just like the object of the abstract class subclass... it can be completely replaced by the subclass object .,
1. The inherited interface must implement all its methods, while the abstract class focuses on the scalability and polymorphism when designing the abstract class. (This is used by the template method principle ),
2. I can only feel that the interface seems to be intended to abstract the function, that is, to indicate that the real user has some ability,
Abstract classes are more inclined to a family concept. The combination of abstract classes and multiple interfaces is like a single lineage, but unlimited learning ability ,,
3. for the inheritance of abstract classes, after multi-level inheritance, it is easy to produce very complex class relationships, and some Members will be more complicated. If there can be more inheritance, this situation will be even more terrible, this may also be the reason why Java abandons multi-inheritance.
We plan to analyze the design model based on the characteristics of object-oriented language ..
When is there time...
Take a rest... wait and read the book.