Friday 16 December 2011

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

namespace IndiabixConsoleApplication
{
    class Sample
    {
        public int func()
        {
            return 1;
        }
        public Single func()
        {
            return 2.4f ;
        }
    }
    class Program
    {
        static void Main(string[ ] args)
        {
            Sample s1 = new Sample();
            int i;
            i = s1.func();
            Single j;
            j = s1.func();
        }
    }
}
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.
Answer: Option C