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  >  Tech FAQs  >  OOPS

 Print  |  
Question:  Why are private fields assigned with public properties?Is this not same as declaring the field Public?



November 11, 2008 11:13:10 #1
 venugopaul   Member Since: November 2008    Total Comments: 1 

RE: Why are private fields assigned with public properties?Is this not same as declaring the field Public?
 
No.By declaring as private field, the value of that field is not visible outside the class....but the value can be retrieved or set using the property...This way you are hiding the data directly but it is accessible only using the function.
     

 

Back To Question