Skip to main content

Four Pillars of OOP

There are four pillars (i.e. defining features) of OOP that every developer should know. If you're a student, you'll likely be tested on this at some point!

We'll dive into each of these in more detail in the upcoming lessons:

Abstraction

Abstraction allows you to focus on the essential aspects of an object while ignoring unnecessary details. It simplifies complex reality by modeling classes based on their relevant characteristics and behaviors.

Encapsulation

Encapsulation involves bundling data (attributes) and the methods (functions) that operate on that data into a single unit, the class. This promotes data hiding, controlled access, and ensures data integrity.

Inheritance

Inheritance enables a new class (subclass) to inherit attributes and methods from an existing class (superclass). This promotes code reusability, extensibility, and the creation of specialized classes.

Polymorphism

Polymorphism allows objects of different classes to be treated as instances of a common superclass. It enables generic programming and simplifies code by providing a consistent interface for diverse objects.