Data Encapsulation and Data Hiding Explained

Jen Gordon
4 min readMar 24, 2018

Introduction

Data encapsulation and data hiding are components of object–oriented programming that can be utilized as a part of the many programming languages that include C, C++, and others. The two are considered as the two principle ideas of the object–oriented programming framework. Data encapsulation and data hiding include objects; named values, data, structures as well as methods.

Data encapsulation is the way toward consolidating and amassing components keeping in mind the end goal to make another substance and the keeping of private data into a class. The encapsulation includes usage concerning the data and the method. Data with inward methods are secured into a case while the methods are utilized to get to the data inside it. In this way, the grouping and gathering of all data inside a case makes it autonomous for an object to work together.

What Is Data Encapsulation

Encapsulation in Object-Oriented programing is a term that refers to storing the data in private fields that can only be modified through methods. Encapsulation can be viewed as a concept that is implemented as a procedure.

The encapsulation additionally includes how all the classes are hidden from clients and how the procedure can be switched by opening the class using methods. In data encapsulation, the case and the object inside it can be named either private or public unless determined or customized by the software programmer.

--

--