What are the different ways a method can be overloaded?

 Posted by Ddd on 2/3/2011 | Category: OOPS Interview questions | Views: 5658 | Points: 40
Answer:

Different parameter data types, different number of parameters, different order of
parameters.

example: int area(int a, int b)
{
return a*b; --different number of parameters
}
int area(int b)
{
return a*a;
}


--parameter return types

int calc(int a)
{
return a;
}

double calc(double b)
{
return b*5;
}


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response