Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

What is meant by encapsulation ? Explain with an example.
Binding up the data and methods into a single
unit, i.e. class is called encapsulation.
Example:

class Area{
      //data variable
      double dim1;
      double dim2;
      //methods
      public double calculateArea(double d1,double d2){
      //some calculation code here
}
}