Interface Features
1. All methods are abstract
2. Properties are static
3. There can be multiple inheritance between interfaces. (equivalent to concentrating the requirements)
4. An inheritance relationship between interfaces
5. Classes and interfaces are implementation relationships
6. Interface-oriented programming to reduce coupling degree
-----------------------------Courseware Part---------------------------------------
The member modifiers in the interface are fixed.
Member constants: public static final
member functions: Public abstract
The members in the interface are public.
The appearance of the interface will show "multiple inheritance" through another form, that is, "multi-Implementation"
Features of the interface:
1. Interface is the rule of external exposure
2. Interface is the function extension of the program
3. The appearance of the interface reduces coupling
4. Interfaces can be used for multiple implementations
5. Classes and interfaces are implementation relationships, and classes can inherit one class and implement multiple interfaces at the same time
6. There can be an inheritance relationship between interface and interface
Abstract class features
1. The class in which the abstract method resides must be an abstract class
2. Abstract classes can have no abstract method
Interface and abstract class comparison
Commonality: Abstract concepts that are constantly extracted
Difference 1: Abstract class embodies inheritance relationship, a class can only inherit
Interface embodies the realization of the relationship, a class can be implemented more
Difference 2: Abstract classes are inherited, are "is a" relationships
Interfaces are implementations, which are "like a" relationships
Difference 3: A non-abstract method can be defined in an abstract class for the subclass to use directly
Interfaces are abstract, and members in an interface are fixed modifiers
Interfaces and abstract classes