Hi, community. What is the difference between an abstract class and an interface in C #? After all, it can be said that the abstract class, in which all methods have no implementation and are marked as abstract, is in some way an interface. Yes, there is a significant difference - the interface describes the behavior of an object, i.e. it must be fully implemented, unlike the abstract class in which, without implementing abstract methods, the heir will also become an abstract class. I understand that the interface describes the general behavior without implementation (for each class has its own), and what does the abstract class do?

Reported as a duplicate by Qwertiy participants , VladD c # Jan 11 '17 at 21:52 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

    2 answers 2

    The interfaces are hollow, so nothing moves inside the object instance and you can safely link to any ancestor. A class can contain fields. If you inherit from two classes with fields (if it were possible), then the reduction to the second would require a shift of the link.

    In general, somewhere there was a question with an answer, covering also the semantic difference between them. Now I will look. Found. Voted to close this as a duplicate.

    • Thank. The link found all the answers - Vadim Prokopchuk

    In a nutshell, we can say that abstract classes are used to build a hierarchy of classes with common properties and behavior, and interfaces define common properties and behavior for objects of different classes that are not related to the hierarchy.