Home / C# Programming / Constructors :: Discussion

Discussion :: Constructors

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

    
    namespace FreshergateConsoleApplication {  
        class Sample    
        {       
           public int func()     
           {           
              return 1;        
           }        
           public Single func()        
           {          
              return 2.4f ;   
           }
     
          }   
          class Program    
          {       
             static void Main(string[ ] ars)         
             {       
                 Sample s1 = new Sample();              
                 int i;       
                 i = s1.func();              
                 Single j;        
                 j = s1.func();     
          }    
       } 
     }
    

  2. A.

    func() is a valid overloaded function.

    B.

    Overloading works only in case of subroutines and not in case of functions.

    C.

    func() cannot be considered overloaded because: return value cannot be used to distinguish between two overloaded functions.

    D.

    The call to i = s1.func() will assign 1 to i.

    E.

    The call j = s1.func() will assign 2.4 to j.

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    No answer description available for this question.


Be The First To Comment