Naveen Kulanthaivel wrote:. . . When should I use an abstract class instead of an interface?
When you have default functionality you want a limited number of types to implement, then an abstract class is probably better. Example:-
All Vehicles have a speed, so you would waqt that as a non‑
abstract method. You don't want to instantiate Vehicle directly, so you mark the class
abstract.
Can a class extend multiple abstract classes?
No.
What are the real-time scenarios where interfaces are preferred? . .
When you don't know how many implementing types you are likely to have. You might make Engine an interface. I wrote about an Engine interface
here.