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

Showing Answers 1 - 3 of 3 Answers

venugopaul

  • Nov 12th, 2008
 

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.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions