01.04 · Cheat sheet
OOP
Object-oriented programming in Java and C++, the way interviewers ask it.
The four pillars
- Encapsulation: hide the data, expose methods (private fields + getters and setters).
- Abstraction: show what it does, hide how (abstract classes, interfaces).
- Inheritance: reuse code through an is-a link (
extends). - Polymorphism: one name, many forms (overloading and overriding).
Overloading vs overriding
| Overloading | Overriding | |
|---|---|---|
| Where | Same class | Subclass |
| Signature | Different parameters | Same signature |
| Decided at | Compile time | Run time |
| Return type | Can differ | Same (or a subtype) |
solulu Pro
Continue this cheat sheet with Pro
Inside: 9 sections.
- The four pillars
- Overloading vs overriding
- Abstract class vs interface (Java)
- Access modifiers (Java)
- Constructors
- Keywords
- +3 more
Lifetime ₹1,999 ₹999 · Launch offer
Item 4 of 12 · updated 2026-10-13