Another key feature of object-oriented programming is encapsulation . Encapsulation means a class can hide the details of:
Application programs manipulate objects of a class using a
clearly defined interface. As long as this interface does not
change, you can change the implementation of a class without
having to change the application programs that use the class.
Encapsulation provides the following advantages:
In C++, encapsulation is accomplished by specifying the level of
access for each member of a class. Both the data members and
member functions of a class can be declared public, protected, or
private depending on the kind of access required.
Note: C++ encapsulation is not a true security
mechanism. It is possible to circumvent the class access controls
that make encapsulation possible. The language is not designed to
prevent such misuse.