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:

    But the abstract conception
    Of private experience at its greatest intensity
    Becoming universal, which we call “poetry,”
    May be affirmed in verse.
    —T.S. (Thomas Stearns)

    Classes struggle, some classes triumph, others are eliminated. Such is history; such is the history of civilization for thousands of years.
    Mao Zedong (1893–1976)