Use this as a quick revision page before interviews.

What are the four pillars of OOP?

Class vs Object

A class is a blueprint. An object is an instance created from that blueprint.

Encapsulation vs Abstraction

Encapsulation Abstraction
Hides/protects data Hides implementation details
Uses private fields and methods Uses interfaces, abstract classes, simple APIs

Overloading vs Overriding

Overloading Overriding
Same name, different parameters Same signature, child implementation
Compile-time Runtime
Inheritance not required Inheritance required

Abstract Class vs Interface

Abstract class is useful for related classes sharing state or behavior. Interface is useful for common capabilities across related or unrelated classes.

Association vs Aggregation vs Composition

Why prefer composition over inheritance?

Composition is more flexible, easier to test, and avoids fragile parent-child hierarchies. Use inheritance only when the relationship is truly is-a.

What is polymorphism?

Polymorphism allows the same method or interface to behave differently depending on the object or method signature.

What is dynamic dispatch?

Dynamic dispatch is runtime method selection based on the actual object type, not just the reference type.

What is SOLID?

What is the difference between 401 and 403 in OOP?

This is not an OOP question; it belongs to authentication/authorization. In OOP interviews, be careful not to mix domains. For OOP, focus on identity of objects, relationships, responsibilities, and behavior.

Interview Advice

Do not just define concepts. Explain: