Interview Q&A / Object-Oriented Programming

INTERVIEW Q&A · 69 QUESTIONS

Object-Oriented Programming interview questions

The four pillars, interfaces, abstract classes and design basics.

  1. How can polymorphism replace a long if-else or switch chain?

    Give each case its own class with the same method, then call that method on the object. Adding a new case means adding a class, not editing the old, tested chain.

    IntermediateQuick answer1 min read