in interview i faced one question
why abstract when interface ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Afzaal Ahmad ZeeshanPosted Oct 18, 2016, 12:17 PM
Note that an abstract class is still a class, but it cannot be instantiated (you cannot do, "new Class()"). Whereas an interface defines the basic structure of a service, for example in ASP.NET, we have IService and that is used by EmailService, SmsService and they have one function in common. They will define their own behavior, either send using SMTP or use an SMS gateway.
For more on this, please read this thread: http://stackoverflow.com/questions/761194/interface-vs-abstract-class-general-oo
prabhu pPosted Oct 18, 2016, 1:26 PM