Does Function Overloading depend on Return Type?

 Posted by vishalneeraj-24503 on 11/29/2013 | Category: OOPS Interview questions | Views: 10020 | Points: 40
Answer:

No,It does not depend on Return Type.Because if return type is different and function name as well as parameter is also same.
Then it will give compile time error.

Below example will give us clear picture:-

public void display(int id)

{
}

public int display(int id)
{
}


Once we compile above example then it will give compile-time error as

Type '_Default' already defines a member called 'display' with the same parameter types

Here _Default is a Page Name.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response