Examveda

What will be the output of the following C# code?
class maths
{
    int i;
    public  maths(int ii)
    {
        ii = -25;
        int g;
        g = ii > 0 ? ii : ii * -1;
        Console.WriteLine(g);
    }
}
class maths1 :maths
{
    public  maths1(int ll) :base(ll)
    {
        ll = -1000;
        Console.WriteLine((ll > 0 ? ll : ll * -1));
    }
}
class Program
{
    static void Main(string[] args)
    {
        maths1 p = new maths1(6);
        Console.ReadLine();
    }
}

A. -25
-1000

B. -1000
-25

C. 25
1000

D. None of the mentioned

Answer: Option C


Join The Discussion

Related Questions on Classes and Objects in C Sharp