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:

    The more abstract the truth you wish to teach, the more you need to seduce the senses to it.
    Friedrich Nietzsche (1844–1900)

    The most powerful lessons about ethics and morality do not come from school discussions or classes in character building. They come from family life where people treat one another with respect, consideration, and love.
    Neil Kurshan (20th century)