This is very basic but thoughtful question i come across in many interviews Why we really want abstract classes and interface even we can make there implementation by simply inheritance.
(technically saying by making functions and overriding it).what would left without creating abstract classes and interface in OOPS
Thanks
Abstract classes allow you to have a foundation stone for the rest of your code. You can create a partially implemented class and then allow users to create concrete instances of it that are more specific to their requirements. The common functionality stays in the abstract class.
A real world analogy is a car hire shop. They hire ‘cars’. The notion of a ‘car’ is an abstract class and can have various methods in their system that allow hire and return, and also properties like insurance group, daily rate etc. However no customer would go up to a hire shop and hire a ‘car’. They’d hire a Ford Focus, a Mercedes, a Skoda Fabia or whatever. So these are concrete instances of an abstract class, and might well be represented in an object-oriented system with specific classes derived from ‘car’.
Interfaces, on the other hand, allow polymorphism. This is when an object of one class gets to behave like one of another. I’m a man who drives a car. I am not a ‘driver’ object (as I do lots of other things), but I might well be regarded as having a ‘driver’ interface which would allow access to my driving license details and the suchlike.