LogiQuest
Back to Inheritance
7

What is the output of the following program?

var d = new Dog();
Console.WriteLine(d.Legs + " " + d.Sound());
class Animal { public int Legs = 4; }
class Dog : Animal { public string Sound() => "woof"; }
Easy

Discussion (0)

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

Log in to join the discussion.