Gina vernon wrote:Does anyone have an answer to the following question? I searched the internet but couldn't find anything that specifically addressed this question.
What can an interface do that a 100% abstract class cannot?
Basically, the question was if a developer can get all the functionality of an interface in a 100% abstract class, why even use an interface?
Thanks.
if you use interfaces to define a contract, then if you change the interface in future, you have to implement the changes in all the classes which implement the interface.
but in a abstract class, you can add concrete methods without needing to make changes in classes which extend the abstract class, thus if your contract is gonna change too often ,
you should use a abstract class to have the base contract + any specialized additional contract features.
And about what a interface can do that a 100% abstract class cannot ? its easy, a interface can extend n numbers of other interfaces, which makes it easy to define a contract based on many other smaller contracts.