Code Quality Design Help

Pillars of OOP

Pillars of OOP

The four pillars of object-oriented programming are:

  • Encapsulation: Bundling data and methods that operate on that data within a single unit, or object.

  • Abstraction: Hiding complex implementation details and showing only the necessary features of an object.

  • Inheritance: Creating new classes from existing classes, inheriting their properties and methods.

  • Polymorphism: Allowing objects of different classes to be treated as objects of a common super class.

In addition to these four, Composition is a fundamental principle of object-oriented design. It involves building complex objects from simpler ones. Many developers prefer composition over inheritance to achieve code reuse and build flexible systems.

See Also:

19 June 2025