What will be the result of code execution?

using System;

namespace Quizful
{
    public class A
    {
        public A()
        {
            Evt += x => Console.WriteLine(x);
        }

        public event Action<object> Evt;

        public void DoAction()
        {
            if (Evt != null)
                Evt("Hello");
        }

        public void Print(object o)
        {
            Console.WriteLine(o);
        }
    }

    public class B : A
    {
        public B()
        {
            Evt += x => Console.WriteLine(x);
        }
    }

    public class Program
    {
        static void Main(string[] args)
        {
            A a = new B();
            a.Evt += a.Print;
            a.DoAction();
            Console.ReadKey();
        }
    }
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
C# quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes