Home / C# Programming / Polymorphism :: Discussion

Discussion :: Polymorphism

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

     public class Sample 
     {    
        public int x;    
        public virtual void fun()    
        { }
     } 
     public class DerivedSample : Sample
     {   
        new public void fun() 
        { } 
     }
    

  2. A.

    DerivedSample class hides the fun() method of base class.

    B.

    The DerivedSample class version of fun() method gets called using Sample class reference which holds DerivedSample class object.

    C.

    The code replaces the DerivedSample class version of fun() method with its Sample class version.

    D.

    It is not possible to hide Sample class version of fun() method without use of new in DerivedSample class.

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    No answer description available for this question.


Be The First To Comment