Q11: What are the Four Pillars of Object-Oriented Programming (OOP)?
- Encapsulation: Hiding state behind
privatefields, exposing access via controlledpublicmethods. - Abstraction: Hiding internal implementation complexity behind simple abstract interfaces or classes.
- Inheritance: Deriving new classes from parent classes to promote code reuse (
extends). - Polymorphism: Allowing objects to take multiple forms (Method Overloading and Method Overriding).
Key Takeaways
- Encapsulation protects data integrity.
- Abstraction simplifies user interaction contracts.
- Inheritance models 'IS-A' hierarchies.
- Polymorphism provides dynamic runtime dispatch.
Knowledge Check
Hiding implementation complexity and exposing only essential functional contracts is known as what?