Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
Does method signature include return type of method also??

This is very conflicting because in MSDN it is written that it doesn't include return type of the methods, but in some books(including Wrox publication) it is written that it includes it.

Can anybody please guide me about this?
Posted
Updated 6-Dec-09 9:57am
v2

wrote:
Does Method signature includes return type of method also??


Method signature never includes return type of method. Method signature only includes the method parameters.

Hence, the following two methods are same & you can't overload:

void StoreAccount(string userName, string address);
bool StoreAccount(string userName, string address);

The following two methods are different as the method parameters are different:

void StoreAccount(string userName);
void StoreAccount(string userName, string address);

Hope, this resolved your problem.
 
Share this answer
 
Take a look here - http://stackoverflow.com/questions/290038/is-the-return-type-part-of-the-function-signature[^]. This documentation given there is for C++.

So, I guess return type in the method signature could depend on the language.

How does Java work?
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900