OOP

Interfaces vs. Abstract classes

Another question I was asked yesterday and had difficulty answering is: when would you use an abstract class, and when would you use an interface? The obvious answer is, you use an abstract class when you need to provide some implementation details. Right. But, exactly when is that? Essentially I Read more…

By kryptx, ago
OOP

Composition vs. inheritance

Today in an interview I was asked, when would you use composition and when would you use inheritance? I struggled with this question, not because I have never considered it, but because the interviewer was asking me to translate abstract concepts about which I have strong intuitions but no formal Read more…

By kryptx, ago