LogiQuest
Back to Interfaces
8

What is the output of the following program?

var d = new Duck();
Console.WriteLine(((IFly)d).Move() + ((ISwim)d).Move());
interface IFly { string Move(); }
interface ISwim { string Move(); }
class Duck : IFly, ISwim
{
    string IFly.Move() => "fly";
    string ISwim.Move() => "swim";
}
Hard

Discussion (0)

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

Log in to join the discussion.