Encapsulation also called information hiding refers to a technique in which data is packaged together with the operations that act on it such that the data can be manipulated only through these operations and not directly. Object oriented languages have special language mechanisms to support data abstraction. Such an encapsulated type is called a Class . Class declarations include data and the member functions that operate on the data. The specifiers Private and Public control access to the members of the class from outside the class.
Private members are available only to member functions of the same class.
Public members are available to any function. Member function definitions must identify their scope. This is because the compiler views each function definition it encounters as a separate entity. Therefore a member function belonging to a particular case must identify itself as such. For example, let us define two init functions.