Inheritance

Q1: What will be the output of the C#.NET code snippet given below?
namespace AptitudeCrackConsoleApplication
{ 
    class Baseclass
    { 
        public void fun()
        { 
            Console.Write('Base class' + ' ');
        } 
    } 
    class Derived1: Baseclass
    { 
        new void fun()
        {
            Console.Write('Derived1 class' + ' '); 
        } 
    } 
    class Derived2: Derived1
    { 
        new void fun()
        { 
            Console.Write('Derived2 class' + ' ');
        }
    }
    class Program
    { 
        public static void Main(string[ ] args)
        { 
            Derived2 d = new Derived2(); 
            d.fun(); 
        } 
    } 
}

A Base class

B Derived1 class

C Derived2 class

D Base class Derived1 class

E Base class Derived1 class Derived2 class

ANS:A - Base class

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.