LogiQuest
Back to Properties and Indexers
7

What is the output of the following program?

var a = new Acc();
a.Balance = -50;
Console.WriteLine(a.Balance);
class Acc
{
    private int bal;
    public int Balance { get => bal; set { if (value >= 0) bal = value; } }
}
Medium

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.