0

Why we have to declare name as private and then as public?

i don t get this... cause we are talking about properties if i want the property age for example.. i ll have to type private age.. public Age?

17th Jul 2016, 1:50 AM
Paula Castillo
3 Answers
+ 1
It makes sense if "age" is a support variable for a property "Age" which has some inner logic in getter and/or setter. Otherwise you should have only "Age" property with no inner logic (public int Age { get; set; })
23rd Jul 2016, 7:14 AM
Ivan G
Ivan G - avatar
0
Ok i think your answer is that each variable is case sensitive so you see it defining "name" and "Name" which appear to be the same bc they are the same word, but actually are treated as if they were two totally dofferent words bc of one having a capital N and the other is lowercase. I hope this helps...
22nd Jul 2016, 2:42 PM
EddieBro
EddieBro - avatar
0
Just because its not one name. Actualy, its two different names. First "age" is private property. second "Age" is public get/set method.
25th Sep 2016, 8:26 PM
hakooplay Play
hakooplay Play - avatar