4
Answers

the significance of 'get' and 'set'

Vivek Datta

Vivek Datta

15y
2.9k
1
hello buddies...
plz help me out understanding folowing stuff... i hav searchd for it in many books but didnt understand...

why in evry class, for evry member we use get and set method...

for ex.

private string firstName;
public string FirstName
{
get { return firstName;}
set {firstName = value; }
}

i have seen such stuff in many languages but dont knw y we use thm??
i hav made programs without evn using such things...

plz help me out guys... plz help me understand the significance of these coding methods... thanks in advance...
Answers (4)