neeru sharma
what is the difference between interface and abstract class?
By neeru sharma in C# on Sep 17 2012
  • neeru sharma
    Sep, 2012 17

    The differences between Abstract Classes and Interfaces are as follows :
    1. An abstract class is a class that can not be instantiated but that can contain code whereas an interface only contains method definitions but does not contain any code.
    2. Interfaces do not come in inheriting chain , while abstract classes come in inheritance.
    3. Classes can implements any no. of interfaces, but extends only one abstract class.
    4. An interface can have only abstract methods. An abstract class can have both abstract methods and concrete methods.
    5. Interfaces cannot have constructors. Abstract class can have constructors.
    6. We should initialize variables in an interface whereas it is not necessary to initialize variables in an abstract class.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS