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