CodePudding user response:
You can implement multiple interfaces, but can only inherit an abstract classCodePudding user response:
When you want to define a specification, and methods do not achieve, just want to let the implementation of a subclass to implement these methods;Or a subclass has inherited the other classes, and to inherit a parent class, you can use the interface,
CodePudding user response:
https://www.cnblogs.com/rennix/p/6372626.htmlCodePudding user response:
Interface is generally used as a method of extension, an abstract class is mainly used for multiple Shared attributes of abstract classCodePudding user response:
An abstract class cannot be instantiated, so is to be inherited, using an interface to implement multiple inheritanceCodePudding user response:
I now is in accordance with the requirements of project implementation,CodePudding user response:
Interface can be used as a component, the things you need to a component, realize the corresponding interface, quantity is not limit, an abstract class can also be regarded as components, but you can only put oneCodePudding user response:
Interface can realize multiple inheritance, but an abstract class can inherit a