Inheritance

Q1: Which of the following is correct about the C#.NET snippet given below?
namespace AptitudeCrackConsoleApplication
{ 
    class Baseclass
    { 
        public void fun()
        { 
            Console.WriteLine('Hi' + ' ');
        } 
        public void fun(int i)
        {
            Console.Write('Hello' + ' ');
        } 
    } 
    class Derived: Baseclass
    {
        public void fun()
        {
            Console.Write('Bye' + ' ');
        } 
    } 
    class MyProgram
    { 
        static void Main(string[ ] args)
        { 
            Derived d; 
            d = new Derived(); 
            d.fun(); 
            d.fun(77);
        } 
    } 
}

A The program gives the output as: Hi Hello Bye

B The program gives the output as: Bye Hello

C The program gives the output as: Hi Bye Hello

D Error in the program

ANS:A - The program gives the output as: Hi Hello Bye

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.