C# Programming - Constructors - Discussion
Discussion Forum : Constructors - General Questions (Q.No. 2)
2.
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();
}
}
}
Discussion:
15 comments Page 2 of 2.
Ammu said:
1 decade ago
@rajiv well said
Nishant Rai said:
1 decade ago
Because in method overloading function name must be same as the class or struct name..and there should be either
1) different parameter
2) return type of parameter
3) sequence of parameter
1) different parameter
2) return type of parameter
3) sequence of parameter
Rajeev said:
1 decade ago
Because in method overloading parameters.
Should be different, not return type.
Should be different, not return type.
Gowtham said:
1 decade ago
I think functions can be overloaded with the type and number of arguments.
Sorna ranjani said:
1 decade ago
Functions are declared and they are not defined. So func is not overloaded.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers