Wednesday 12 August 2015

what is difference between Abstract Class and Interface in .net

 Main differences of both 


Abstract Class: 

  1. Abstract class may contain complete or incomplete methods.
  2. It can implement methods.
  3. An Abstract class can contain fields, constructors or destructors and implement properties.
  4. It cannot support multiple inheritance.
  5. It only on abstract class.
  6. Various access modifiers such as abstract, protected, internal, public, virtual etc.....

Interface :

  1. Interface can contain only the signature of the method but no body.
  2. It cannot implement methods.
  3. It cannot contain fields, constructors or destructors and it has only properties , signature but no implementation
  4. It support multiple inheritance.
  5. Class may inherit several interfaces.
  6. But not  in interface.
                     Abstract classes are faster than interface.

      




No comments:

Post a Comment