Discussion Forum

  1. Home
  2. »
  3. Languages
  4. »
  5. Which of the following statements...
Which of the following statements is correct about the C#.NET code snippet given below?adfasdfasd
namespace ConsoleApplication
{ 
    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(); 
        } 
    } 
}

Func() is a valid overloaded function.

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

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

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

Answer: C . Func() cannot be considered overloaded because: return value cannot be used to distinguish between two overloaded functions.
0Shares
0 0

If you think the posted answer is wrong or Confused About the Answer? Ask for Details Here

Know Explanation? Add it Here
we’ll review your comment and contact you soon….

Leave a Reply

Your email address will not be published. Required fields are marked *

error: You are not allowed to do so.....
0Shares
0
Scroll to Top