Pergunta de entrevista da empresa UST

What is the difference between interface and abstract class?

Resposta da entrevista

Sigiloso

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