Sollicitatievraag bij UST

What is the difference between interface and abstract class?

Antwoord op sollicitatievraag

Anoniem

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