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:

    We must trust infinitely to the beneficent necessity which shines through all laws. Human nature expresses itself in them as characteristically as in statues, or songs, or railroads, and an abstract of the codes of nations would be an abstract of the common conscience.
    Ralph Waldo Emerson (1803–1882)

    What’s the greatest enemy of Christianity to-day? Frozen meat. In the past only members of the upper classes were thoroughly sceptical, despairing, negative. Why? Among other reasons, because they were the only people who could afford to eat too much meat. Now there’s cheap Canterbury lamb and Argentine chilled beef. Even the poor can afford to poison themselves into complete scepticism and despair.
    Aldous Huxley (1894–1963)