Question d’entretien chez UST

What is the difference between interface and abstract class?

Réponse à la question d'entretien

Utilisateur anonyme

21 août 2024

Interface acts a contract for a class and wont have a method body whereas abstract class can have methods with method body . Interface is used to achieve multiple inheritance whereas abstract class is used as a single level inheritance . It is better to use abstract class at the begining of the project design whereas interace can be used to segregate the application by using SOLID principles