Clarification of basic concepts

zhaozj2021-02-17  61

1. What are the benefits of abstract classes and interfaces in design?

2. Difference between static method and example method?

The most basic difference is:

The interface is an agreement, a convention, once it is released, can not be changed, can only increase the function by defining a new interface. And the members defined in the interface cannot be implemented in the interface. Members in the interface are "abstract".

Abstract classes can be partially implemented. And it will increase the new member, which is incapable of a published interface.

Of course, if you want to bring the project from the beginning, you can change anything. The large number of interfaces in the .NET in Microsoft is released will never change. This is the interface. And the new version of .NET can have some enhancements to some classes, but will not affect your original code running on the new version. And the changes of the interface will likely you lead to re-write code.

转载请注明原文地址:https://www.9cbs.com/read-30585.html

New Post(0)