Encapsulation

In this lesson, you'll get familiar with the component of data hiding i.e. Encapsulation.

We'll cover the following

Definition

Encapsulation is a fundamental programming technique in OOP used to achieve data hiding.

Encapsulation in OOP refers to binding the data and the methods to manipulate that data together in a single unit (class).

Depending upon this unit, objects are created. Encapsulation is normally done to hide the state and representation of an object from outside. A class can be thought of as a capsule having methods and data members inside it.

Get hands-on with 1400+ tech skills courses.