Home / C# Programming / Inheritance :: Discussion

Discussion :: Inheritance

  1. 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 ***]     
         } 
      }
    

     

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

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    No answer description available for this question.


Be The First To Comment