Monday, 19 March 2012

Encapsulation


Encapsulation:

Encapsulation is the concept of binding data along with its corresponding functionalities.
It came into existence in order to provide security for the data present inside the program. Any object oriented programming language file looks like a group of classes. Everything is encapsulated, nothing is outside the class. Encapsulation is the back bone of oop language.
Example is class.

Class Encapsulation
{       
   // the Bicycle class has
    // three fields
    int cadence;
    int gear;
    int speed;
    void setGear()
    void applyBrake()
}


No comments:

Post a Comment