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:
“If our minds could get hold of one abstract truth, they would be immortal so far as that truth is concerned. My trouble is to find out how we can get hold of the truth at all.”
—Henry Brooks Adams (18381918)
“The want of education and moral training is the only real barrier that exists between the different classes of men. Nature, reason, and Christianity recognize no other. Pride may say Nay; but Pride was always a liar, and a great hater of the truth.”
—Susanna Moodie (18031885)