Difference between Abstract Class and Interface

Abstract Class and Interface

An abstract class cannot support multiple inheritance, but an interface can support multiple inheritance. Thus a class may inherit several interfaces but only one abstract class.

An interface is an empty shell, just only the signatures of the methods. The methods do not contain anything. The interface can't do anything. It's just a pattern. An Abstract class is a class which will contains both definition and implementation in it.

Abstract classes can have consts, members, method stubs and defined methods, whereas interfaces can only have consts and methods.

Various access modifiers such as abstract, protected, internal, public, virtual, etc. are useful in abstract Classes but all methods of an interface must be defined as public.

A child class can define abstract methods with the same or less restrictive visibility, whereas a class implementing an interface must define the methods with the exact same visibility.

If we add a new method to an Interface then we have to track down all the implementations of the interface and define implementation for the new method. But if we add a new method to an abstract class then we have the option of providing default implementation and therefore all the existing code might work properly.