Lecture:
- declare fields/variables as private
- provide public get and set methods, through properties, to access and update the value of a private field
classPerson{
privatestring name;// field
publicstringName{get;set;}// property
}
classProgram
{
staticvoidMain(string[] args)
{
Person person=newPerson();
person.Name="Zahid";
Console.WriteLine(person.Name);
}
}
/69
Comments 1
odd namber "Bejor namber" and Even namber"Jor namber"
Comments 1