Why do both the abstract class and interface exist in C#?

前端 未结 11 1934
渐次进展
渐次进展 2020-12-03 00:00

Why do both the abstract class and interface exist in C# if we can achieve the interface feature by making all the members in the class as abstract.

Is it because:

11条回答
  •  独厮守ぢ
    2020-12-03 00:35

    An Interface defines a contract that an implementing class must fulfil; it is a way of stating that "this does that". An Abstract Class is a partial implementation of a class which is by definition incomplete, and which needs a derviation to be completed. They're very different things.

提交回复
热议问题