Vivek Datta

Vivek Datta

  • NA
  • 8
  • 0

the significance of 'get' and 'set'

Dec 12 2009 2:09 PM
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)