Hi,
What is the difference between abstract class and interface ?
Loading
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
SenthilkumarRank #387 · 6.5K reputationPosted Mar 16, 2012, 7:52 PM EDT
The abstract class can have access modifiers (internal and public). The interface will have the public as default access modifier.
The interface cannot have implementation of methods. But the abstract class can have non abstract methods.
The interface can be base class to implement the multiple inheritance. But the abstract classes cannot be base class to implement the multiple inheritance
You can see the difference in table format.
Features Interfaces abstract class
Multiple inheritance
A class may inherit several interfaces.
A class may inherit only one abstract class.
Default implementation
An interface cannot provide any code, just the signature.
An abstract class can provide complete, default code and/or just the details that have to be overridden.
Core VS Peripheral
Interfaces are used to define the peripheral abilities of a class. In other words both Human and Vehicle can inherit from a IMovable interface.
An abstract class defines the core identity of a class and there it is used for objects of the same type.
Homogeneity
If various implementations only share method signatures then it is better to use Interfaces.
If various implementations are of the same kind and use common behaviour or status then abstract class is better to use.
Speed
Requires more time to find the actual method in the corresponding classes.
Fast
Satyapriya NayakRank #47 · 31.5K reputationPosted Mar 16, 2012, 8:33 PM EDT
Please also refer Our recommended articles.
Thanks