This question is very common in Interviews.If we want to increase reusability of code in inheritance then abstract classes are good. If we want implement or force some methods across classes must be for uniformity you can use a interface. So to increase reusability via inheritance use abstract class as it is nothing but a base class and to force methods use interfaces.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
This question is very common in Interviews.If we want to increase reusability of code in inheritance then abstract classes are good. If we want implement or force some methods across classes must be for uniformity you can use a interface. So to increase reusability via inheritance use abstract class as it is nothing but a base class and to force methods use interfaces.