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