OOP is a programming paradigm based on the concept of objects. Objects are used to represent self-contained entities, and they communicate with other objects by sending or receiving messages via well-defined public interfaces(aka public methods).

Each object contains hidden implementations(code) and internal state(data).

Essential Components of OOP

Encapsulation

Encapsulation is the guiding principle behind the OOP paradigm, and there are 2 facets to encapsulation:

By doing so, coupling is reduced between modules, and better modularity is achieved.

Encapsulation and Access Modifier

Languages provide “access modifiers” which are keywords/syntax that specify the visibility/accessibility of a class’s method and fields to code outside the class.

Generally, there are three levels of access visibility