C Sharp Syntax - Object-oriented Programming (OOP) - Interfaces - Interfaces Vs. Abstract Classes

Interfaces Vs. Abstract Classes

Interfaces and abstract classes are similar. The following describes some important differences:

  • An abstract class may have member variables as well as non-abstract methods or properties. An interface cannot.
  • A class or abstract class can only inherit from one class or abstract class.
  • A class or abstract class may implement one or more interfaces.
  • An interface can only extend other interfaces.
  • An abstract class may have non-public methods and properties (also abstract ones). An interface can only have public members.
  • An abstract class may have constants, static methods and static members. An interface cannot.
  • An abstract class may have constructors. An interface cannot.

Read more about this topic:  C Sharp Syntax, Object-oriented Programming (OOP), Interfaces

Famous quotes containing the words abstract and/or classes:

    “Delight at having understood a very abstract and obscure system leads most people to believe in the truth of what it demonstrates.”
    —G.C. (Georg Christoph)

    “My plan of instruction is extremely simple and limited. They learn, on week-days, such coarse works as may fit them for servants. I allow of no writing for the poor. My object is not to make fanatics, but to train up the lower classes in habits of industry and piety.”
    —Hannah More (1745–1833)