.Net > Beginner

What would be the output of following code snippet?

using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        Human w = new Woman();

        w.CleanTheRoom();
        Console.ReadLine();
    }
}

class Human
{
    public virtual void CleanTheRoom()
    {
        Console.WriteLine("Human");
    }
}
class Woman : Human
{
    public override void CleanTheRoom()
    {
        //women clean faster
        Console.WriteLine("Woman");
    }
}
class Man : Human
{
    public override void CleanTheRoom()
    {
        //women clean slower, different code
        Console.WriteLine("Man");
    }
}
class Child : Human
{
    public override void CleanTheRoom()
    {
        //empty..children are lazy :)
        Console.WriteLine("Child");
    }
}
Answers :
Time Left
Question Number : /20
Please do not press back or refresh button during this test.

Login

Register

Next Question