How can you overload a method?

Answers were Sorted based on User's Feedback



How can you overload a method?..

Answer / rakesh

A class contains more than one function with the same name
but different method signature ie different access
type,return type,parameters.

public void int sum(int i,int j)
{
int tot=i+j;
Console.WriteLine(tot);
}

public void double sum(double p,double q)
{
double tot=p+q;
Console.WriteLine(tot);
}

if we are passing integer values means the first function
will invoke,and if we are passing double values means the
second will work.This is method overloading.

Is This Answer Correct ?    3 Yes 0 No

How can you overload a method?..

Answer / swapna

we can overload a method by giving same method names with
different parameters. Parameters may differ in data type or
in number.
This is called method overloading .

Is This Answer Correct ?    1 Yes 0 No

How can you overload a method?..

Answer / niraj bajaj

Hi

@Rakesh

Return types doesnt include in these..
only different set of parameters and their access types..

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Sharp Interview Questions

Explain the steps to create satellite assembly?

0 Answers  


What are the advantages of constructor?

0 Answers  


How many root nodes are there in an xml document?

0 Answers  


What is a satellite assembly in c#?

0 Answers  


what are ways to debug the code step by step except using breakpoints?

1 Answers  


STATIC METHOD CAN BE OVERLOADING AND OVERIDNG? IS POSSIBLE IN iN c# .NET AND WHAT IS THE REASON??

3 Answers   IBM, TCS,


what are the benefits in using c# ?

1 Answers  


Hi Friends, I am going through Siemens Interview Procedure from last 1+1/2 months. I went through 1 written + 2 Technical + 1 Managerial Round process after which I got call from HR informing that "you are selected and we would like to meet you for HR round". HR round was very nominal compared to MR. HR Round last for hardly 5 mins. They told me that you will get the final result on Friday. Still I have not received any feedback from them. Please help!!!

0 Answers   Siemens,


how to implement singelton in C# & its uses?

1 Answers   TCS,


What is difference between iqueryable and ienumerable in c#?

0 Answers  


Explain the difference between class and interface in .net?

0 Answers  


Why c# is type safe?

0 Answers  


Categories