CSharp - What is the output: private setter property

Question

What is the output from the following code

using System;
class MyClass
{
    private double radius = 10;
    public double Radius
    {
        get
        {
            return radius;
        }
        private set
        {
            radius = value;
        }
    }
    public double Area => 3.14 * radius * radius;
}
class Program
{
    static void Main(string[] args)
    {
        MyClass ob = new MyClass();
        ob.Radius = 5;
        Console.WriteLine("Radius of the circle {0} unit", ob.Radius);
        Console.WriteLine("Area of the circle is {0} sq. unit", ob.Area);
    }
}


Click to view the answer

Compile time error

Note

the set accessor is preceded by the keyword private.

Related Quiz