Pregunta de entrevista de UST

What is the difference between interface and abstract class?

Respuesta de la entrevista

Anónimo

21 ago 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