Home / C# Programming / Inheritance :: Discussion

Discussion :: Inheritance

  1. What will be the output of the C#.NET code snippet given below?

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

     

  2. A.

    Base class

    B.

    Derived1 class

    C.

    Derived2 class

    D.

    Base class Derived1 class

    E.

    Base class Derived1 class Derived2 class

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    No answer description available for this question.


Be The First To Comment