ENCAPSULATION
• Encapsulation:- The Process of Combinig the Data & Function in a single unit is called as Encapsulation. In the process Encapsulation the Data & Function are bundled in a single digit known as CLASS. Data is only accessible through the Function present inside the Class. The programmer can’t directly access the Data by using the method of Encapsulation. C++ provides the ability to define classes and functions as its primary encapsulation mechanisms with in a class, members can be declared as either public, protected, or private in order to explicitly enforce encapsulation. A public member of the class is accessible to any function. A private member is accessible only to functions that are members of that class and to functions and classes explicitly granted access permission by the class ("friends"). A protected member is accessible to members of classes that inherit from the class in addition to the class itself and any friends.
For more interesting Article’s………Click Here
Encapsulation in c++
ReplyDeleteReal life example of encapsulation in C++
Great, keep sharing