Class
Abstract class)
Interface)
Method implementation
Either implemented or not
Not Allowed
Not Implemented
Member variables
Yes
Yes
None
Instantiation
Yes
No
No
Inheritance
It can inherit one class and multiple interfaces.
It can inherit one class and multiple interfaces.
Multiple Interfaces can be inherited (merged)
Member Functions
Yes
There are unimplemented member functions
Unimplemented member functions
Abstraction
Is feature abstraction
Is the abstraction of behavior
Interface(Interface) is a variant of the abstract class. all methods in the interface are abstract. multi-inheritance can be achieved by implementing such an interface. all methods in the interface are abstract, and no program question exists. The interface can only define static final member variables. the implementation of an interface is similar to that of a subclass, except that the implementation class cannot inherit behaviors from the interface definition. when a class implements a special interface, it defines all the methods of this interface. then, he can call the interface method on any object that implements the interface class. abstract classes allow the use of interfaces as reference variable types.
Abstract classClasses that declare some methods rather than implementation are called abstract classes. They are mainly used to create classes with basic behaviors and declare methods for classes, but cannot create instances for them. you can create a variable and point it to an instance of a specific subclass. it cannot be an abstract constructor or an abstract static method. abstract classes provide implementation for all Abstract methods in their parent classes, otherwise they are also Abstract classes. this abstract method is implemented in the subclass. other classes that know their behavior can implement these methods in the class.