Oops
explain difference b/w interface and abstraction classes?
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 attend5days leftRegister
Nipun TomarRank #90 · 23K reputationPosted Dec 22, 2013, 6:13 PM EST
Abstract Class:
a) An abstract class is a special kind of class that cannot be instantiated.
b) It allows the other classes to inherit from it but cannot be instantiated.
c) It is used to carry the same hierarchy or standards for all the subclasses.
Interface:
a) An interface is not a class,but it is an entity and has no implementation.
b) It has only the definition of the methods without the body.
Differences:
1) A class may inherit several interfaces, but inherit only one abstract class.
2) An abstract class can provide complete code, but interface provides just the signature.
3) An abstract class can contain access modifiers for the subs, functions, properties, but an interface cannot.
4) An abstract class defines the core identity of a class, but interfaces are used to define the peripheral abilities of a class.
5) An abstract class is fast whereas the interfaces requires more time to find the actual method in the corresponding classes.
6) If we add a new method to an abstract class, there we can provide the default implementation and therefore all the existing code might work properly whereas in interface, we have to track down all the implementations of the interface and define implementation for the new method.
7) In Interface, we cannot define the fields whereas in an Abstract class, we can define the fields and constants.
Read this: http://www.aspdotnet-suresh.com/2010/04/abstract-versus-interface.html
http://blog.ploeh.dk/2010/12/02/Interfacesarenotabstractions/
Thanks
Jignesh TrivediRank #16 · 50.3K reputationPosted Dec 22, 2013, 7:27 PM EST
hi,
Please refer
http://www.codeproject.com/Articles/11155/Abstract-Class-versus-Interface
http://www.c-sharpcorner.com/uploadfile/prasoonk/abstract-class-vs-interface/
http://msdn.microsoft.com/en-us/library/scsyfw1d(v=vs.71).aspx
hope this will help you.
Gurunatha Dogi44 reputationPosted Jul 16, 2014, 12:22 PM EDT
http://www.onlinebuff.com/article_abstract-class-and-abstract-method-with-an-example-using-c_7.html
To understand interface in c# check the link below
http://www.onlinebuff.com/article_implementing-interface-in-c-with-an-example_18.html
Differences in provided in the both articles