What is Encapsulation:
Standard definitions says that it a process of wrapping up of data members and methods inside a class with the help of some access specifiers..
private,public and protected.
Private is a type of an access specifier which can be applied to a class, data member,method.
If given to a class then the data members,methods in that class can only access the class which is given as private.
public is type of an access specifier which can again be applied to a class, data members, methods and can be accessed from anywhere in the program.
protected is an other type of access specifier which can again be applied to a class,data members and methods and only the derived classes of that base class can be accessed to the base class which is protected.
Standard definitions says that it a process of wrapping up of data members and methods inside a class with the help of some access specifiers..
private,public and protected.
Private is a type of an access specifier which can be applied to a class, data member,method.
If given to a class then the data members,methods in that class can only access the class which is given as private.
public is type of an access specifier which can again be applied to a class, data members, methods and can be accessed from anywhere in the program.
protected is an other type of access specifier which can again be applied to a class,data members and methods and only the derived classes of that base class can be accessed to the base class which is protected.