Difference between Abstract class and Interface

Posted by Satyapriyanayak under C# category on | Points: 40 | Views : 1279
Abstract Class:-

1) An abstract method is created by specifying the abstract type modifier.
2) An abstract method contains no body.
3) An abstract method is not implemented by the base class.
4) An abstract method is automatically virtual.
5) A derived class must override it.
6) Abstract class can have modifiers for methods,properties etc.,
7) An abstract class can implement a property.
8) The abstract modifier cannot be applied to static methods.
9) Properties can also be abstract.
10) A class containing abstract methods must be declared as abstract with the abstract specifier.
11) There can be no objects of an abstract class.
12) If a derived class doesn't implement all of the abstract methods in the base class, then the derived class must also be specified as abstract.
13) An abstract class can inherit from a class and one or more interfaces.
14) An abstract class can implement code with non-Abstract methods.
15) Abstract class can have constant and fields.
16) An abstract class can have constructors or destructor's.
17) An abstract class cannot be inherited from by structures.
18) An abstract class cannot support multiple inheritance.
19) 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.


1) Interfaces cannot be instantiated directly.
2) Interfaces can contain events, method, indexer and properties.
3) An Interface can contain property definitions.
4) Interfaces contain no implementation of methods.
5) Classes and Structs can implement more than one interface.
6) An Interface can be inherited from by structures.
7) An interface itself can inherit from multiple interfaces (Interface can support multiple
8) An abstract class can implement a property.
9) 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.

Comments or Responses

Login to post response