LogiQuest
Back to Constructors
12

What is the output of the following program?

var r = new Rect(4);
Console.WriteLine(r.Area);
class Rect
{
    public int W, H;
    public Rect(int s) : this(s, s) { }
    public Rect(int w, int h) { W = w; H = h; }
    public int Area => W * H;
}
Medium

Discussion (0)

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

Log in to join the discussion.