Examveda

What will be the output of the following C# code?
class maths
{
    int i;
    public maths(int x)
    {
        i = x;
        Console.WriteLine(" hello: ");
    }
}
class maths1 : maths
{
    public  maths1(int x) :base(x)
    {
        Console.WriteLine("bye");
    }
}
class Program
{
    static void Main(string[] args)
    {
        maths1 k = new maths1(12);
        Console.ReadLine();
    }
}

A. hello bye

B. 12 hello

C. bye 12

D. Compile time error

Answer: Option A


Join The Discussion

Related Questions on Classes and Objects in C Sharp