In context of recent trends in interviews i have noticed that this question arises every time. But when one answers the general definition then the interviewer says everyone knows it… tell something different. Further scenarios are asked where which one will be used and be beneficial and why
So kindly share any new insight into this topic.
Thanks in advance…
An abstract class can define base implementations of methods along with data members that are protected or private, while an interface only defines the functionality that a class must provide along with public data members.
The way I like to look at it is that an abstract class is a foundation for other classes. It not only specifies the operations that a specific family of things has to have, but also the data that these operations need to do their work. Specific children can add (or even ignore, if needed) specific data elements. An interface, on the other hand, is a contract – it says nothing about how you are going to do something, only what things you must do and what you will make visible to the outside world. Your inner workings are your own business in an interface.