Encapsulation is a technique of linking together attributes and procedures to form an object.
Encapsulation enables a programmer to institute checks and balances by placing attributes and procedures in a class and then defining rules in the class to control its access.
An access specifier is a programming language keyword that tells the computer what part of the application can access data and functions/ methods defined within the access specifier.
The public access specifier determines attributes and procedures that are accessible by using an instance of the class.
The private access specifier identifies attributes and procedures that are only accessible by a procedure that is defined by the class.
The protected access specifier stipulates attributes and procedures that can be inherited and used by another class.
A subclass inherits public and protected portions of the super class.
In C++, access specifiers define a section of a class that contains attributes and member functions. In Java, each attribute and member method contains the access specifier.
A super class cannot access any portion of a subclass.
Programmers require that some attributes of a class be accessed only by a member procedure in order to validate values assigned to attributes. A programmer who wants access to some attributes calls a member procedure, which applies any validation rules before assigning values to attributes.