Hi,
What is the difference between an Abstract class and an 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
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Oct 21, 2012, 11:16 PM EDT
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Oct 21, 2012, 10:38 PM EDT
public abstract class myclass
{
void getNames();
void Getdetails()
{
//do something;
}
public interface IVehicle
{
void getNames();
void Getdetails();
}
One more is you can provide access specifier for the methods in abstract class but you cant specify any for interface methods, not even public.
Roopa Lingayath7 reputationPosted Oct 21, 2012, 11:10 PM EDT
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Oct 21, 2012, 11:14 PM EDT
but with interfaces, you can inherit a child class from multiple interfaces.
Also it provides uniformity and standardization of methods.
Check this for real time example.
http://www.shubho.net/2010/08/what-is-interface-why-should-you-use.html
Roopa Lingayath7 reputationPosted Oct 21, 2012, 11:15 PM EDT
Roopa Lingayath7 reputationPosted Oct 21, 2012, 11:17 PM EDT
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Oct 21, 2012, 11:17 PM EDT