--- title: "The Fundamental Pillars of Object-Oriented Programming" description: "Explore the core principles of object-oriented programming (OOP)." image: "https://assets.bytebytego.com/diagrams/0197-4-fundamental-pillars-of-object-oriented-programming.png" createdAt: "2024-03-06" draft: false categories: - software-development tags: - OOP - Principles --- ![](https://assets.bytebytego.com/diagrams/0197-4-fundamental-pillars-of-object-oriented-programming.png) Abstraction, Encapsulation, Inheritance, and Polymorphism are the four pillars of object-oriented programming. What do they mean? ## Abstraction This is the process of hiding implementation details and showing only the essential features of an object. For example, a Vehicle class with an abstract stop method. ## Encapsulation It involves wrapping data (fields) and methods in a single unit (class) and restricting direct access using access modifiers. For example, private fields with public getters and setters. ## Inheritance The process of creating a new class (child) that inherits attributes and methods from an existing class (parent), thereby promoting code reuse. For example, a Car class inherits from a Vehicle class. ## Polymorphism It allows methods to perform differently based on the object they are invoked on. When two types share an inheritance chain, they can be used interchangeably with no errors.