C Sharp (C#) - Properties and Encapsulation
What will be the output of this C# code?
class Person {
private string name = "Alice";
public string Name {
get { return name; }
set { name = value; }
}
}
var p = new Person();
p.Name = "Bob";
Console.WriteLine(p.Name);