GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Concepts  >  OOPS

 Print  |  
Question:  what is the difference between encapsulation and datahiding.explain with example



December 12, 2005 12:08:13 #3
 revathi Microsoft Expert  Member Since: December 2005    Total Comments: 2 

RE: what is the difference between encapsulation and d...
 

It is the mechanism that binds together code and data in manipulates, and keeps both safe from outside interference and misuse. In short it isolates a particular code and data from all other codes and data.

ex:

Class Base

{

int a=1;

Public void fun1{}

}

Abt data hiding,we access the data from a class in a secure way using the object.

     

 

Back To Question