+ 6
In simple word
Hiding your variables or method outside from class. This behavior can be achived via using private (access-modifire)
+ 5
And best example for encapsulation is Class.
In class, you encapsulate data members(variables) and methods into a one single unit.
class A
{
//Variables declarations..
..
//Methods implementations...
}
+ 3
Wrapping data and function into I single entity ....
This is related to the object oriented bro...
+ 3
Wrapping data and function into I single entity ....
This is related to the object oriented bro...
+ 3
simply, encapsulation means wrapping up of data and functions into a single unit normally called a âclassâ
It is one of the basic concepts of object oriented programming languages
+ 2
Encapsulation simply means binding object state(fields) and behaviour(methods) together The main idea behind encapsulation is to hide the implementation details from users.
+ 2
It is one of the OOP fundamentals. It allows the programmer to use private attributes in a class and these attributes are only accessible through get and set methods. This allows more manageable code and allows the validation of these attributes before being used by other classes. Changing becomes in one place.
+ 1
Encapsulation
Think of it as a family, where some members of the family are not at all allowed to come out and talk with others (private), the communication is through the elders to the whole family, with the outside world(public)
0
Is conception to protect data.