Search
Lessons (7)
- Polymorphism
… Learn how polymorphism lets you treat different objects the same way, replace long if/else chains, and add …
- OOP Mistakes and Interview Questions
… What is polymorphism? Give an example.</strong </summary Polymorphism means one interface, many implementations. For example, PaymentMethod.pay …
- What Is Object-Oriented Programming?
… encapsulation, abstraction, inheritance and polymorphism](/img/oop/four-pillars.svg) Pillar In one sentence Real-life example --- --- --- Encapsulation …
- Code Smells & Refactoring
… this.currency }).format(this.cents / 100); } } Switch statements → Polymorphism js // ❌ This switch is repeated in area(), perimeter(), draw …
- O — Open/Closed Principle
… classes, functions, config), not editing tested code. - Use polymorphism, strategy maps, plugins or middleware to create extension points …
- L — Liskov Substitution Principle
… Prefer composition or separate types. - LSP is what makes polymorphism (and the Open/Closed Principle ) safe.
- JavaScript Language Fundamentals
… Inheritance Prototypes / extends (prefer composition when in doubt) Polymorphism Any object with the right method works ("duck typing …