What is data encapsulation in OOPL?
Hello,
Encapsulation is one of the fundamental conceps in OOP. This concept is also often used to hide the internal representation, or state, of an object from the outside. This is called information hiding. The general idea of this mechanism is simple. If you have an attribute that is not visible from the outside of an object, and bundle it with methods that provide read or write access to it, then you can hide specific information and controlbundless to the internal state of the object.
If you’re familiar with any object-oriented programming language, you probably know that these methods as getter and setter methods. As the names indicate, a getter method retrieves an attribute, and a setter method changes it. Depending on the methods that you implement, you can decide if an attribute can be read and changed, or if it’s read-only, or if it is not visible at all. As I will show you later, you can also use the setter method to implement additional validation rules to ensure that your object always has a valid state
Hope this helps....
Hello Arnab,
Date encapsulation is one of the basic concepts of OOPs.
It basically means to bind together data and functions that will keep it safe from outside interference and misuse of data.
So, it is also known as data hiding.
Hope this was helpful.