Hi friend
what is the difference between interface and abstract
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Mahesh ChandRank #1 · 393.3K reputationPosted Sep 28, 2007, 7:18 AM EDT
http://www.c-sharpcorner.com/UploadFile/rmcochran/csharp_interrfaces03052006095933AM/csharp_interrfaces.aspx?ArticleID=cd6a6952-530a-4250-a6d7-54717ef3b345
AlanRank #669 · 3.6K reputationPosted Sep 28, 2007, 7:35 AM EDT
In addition to that excellent article which Mahesh has linked to, here is a quick summary of the main differences between interfaces and abstract classes:
1. A class can implement multiple interfaces but can only inherit from one abstract class.
2. An interface never provides an implementation of any of its members, all of which are implicitly public. All classes which implement the interface MUST provide implementations for all its members.
3. An abstract class can provide both abstract and 'concrete' members. It never provides implementations for its abstract members, this being left to derived classses unless they themselves are abstract. However, it does need to provide implementations for concrete members in the normal way.
4. An interface cannot contain fields, constructors, destructors or static members of any description but an abstract class can. However, none of these can be abstract and instance constructors are normally 'protected' so that the abstract class cannot be instantiated externally.