Encapsulation

Encapusulation

Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse.

When we create a class, we will specify the code and data that constitute that class; collectively, these elements are called members of the class, specifically, the data defined by the class are referred to as member variable or instance variables. The code that operates on that data is referred to as member methods or just methods. Each method or variables in a class may be marked private or public.

X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now