🏛️ Placement

OOP Concepts for Interviews — The 4 Pillars With Real Examples

📅 Jul 2, 2026 ⏱ 5 min read

Every technical round touches OOP. The pillars are easy to list and hard to explain — interviews grade the explanation.

The four pillars with one running example

class Account {
  #balance = 0;                          // ENCAPSULATION — private state
  deposit(amt) {
    if (amt <= 0) throw new Error();     // controlled access
    this.#balance += amt;
  }
  get balance() { return this.#balance; }
}

class SavingsAccount extends Account {   // INHERITANCE — reuse + extend
  addInterest() { this.deposit(this.balance * 0.04); }
}

The follow-ups that filter

Full practice: interview question bank.

← All Articles