Similarities: both are at the top of inheritance, used to be implemented or inherited by other classes; Can't instantiate objects directly; Both contain abstract methods that must be overridden by subclasses; Differences: Abstract classes provide implementation for some methods, avoiding subclasses to implement these methods repeatedly, improving code reuse; Interfaces can only contain abstract methods; A class can inherit only one direct parent (possibly an abstract class), but can implement multiple interfaces; (Interfaces compensate for Java's single inheritance.) Abstract classes are what you should have in this thing, and inheritance is a kind of is.. A Relational interface is something extra in this thing, inheritance is a kind of like.. A relates to the selection of the two: give priority to interfaces and use abstract classes as little as possible; Use abstract classes only when you need to define the behavior of subclasses and provide common functionality for subclasses.Copy the code
Attachment: Personal e-commerce in Taiwan open source project
It’s a square pavilion.
Link: github.com/ChenJinchen…
Square Pavilion is a cube project for e-Commerce. In fantasy novels, there are always some powerful neutral organizations between various forces, and these organizations usually have the character “pavilion”. Therefore, this project is named “Sifang Pavilion”, which is inclusive and accumulates, absorbing the long meaning of hundreds of schools. Welcome interested partners to work together to improve and promote this project. Github square-pavilion