Home / C# Programming / Inheritance :: Discussion

Discussion :: Inheritance

  1. Which of the following is correct about the C#.NET snippet given below?

     namespace FresherGateConsoleApplication
     {   
        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);  
               }    
           } 
        }
    

  2. 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

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    No answer description available for this question.


Be The First To Comment