Inheritance

Q1:
Which of the following statements should be added to the subroutine fun( ) if the C#.NET code snippet given below is to output 9 13?
class BaseClass
{
    protected int i = 13;
}
class Derived: BaseClass
{
    int i = 9; 
    public void fun()
    {
        // [*** Add statement here ***]
    } 
}

A Console.WriteLine(base.i + ' ' + i);

B Console.WriteLine(i + ' ' + base.i);

C Console.WriteLine(mybase.i + ' ' + i);

D Console.WriteLine(i + ' ' + mybase.i);

E Console.WriteLine(i + ' ' + this.i);

ANS:B - Console.WriteLine(i + ' ' + base.i);

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.