| Author |
Method signature
|
Ramesh Donnipadu
Ranch Hand
Joined: Sep 16, 2000
Posts: 100
|
|
Does return type of a method included in the method's signature? Design Patterns by GoF says yes. But Khalid Mughal and few others say return type is not part of method's signature.
|
 |
Nathan Pruett
Bartender
Joined: Oct 18, 2000
Posts: 4121
|
|
Ramesh, It depends what you are talking about -- Technically, yes, the return type of a method is included in it's signature, since it is something that differentiates that method from other methods. But, in Java ( and C++, and probably all other languages ) return type is usually not included in a method signature because if all that is different in two methods is the return type, Java will not know which method to call. HTH, -Nate
|
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
|
 |
John Wetherbie
Rancher
Joined: Apr 05, 2000
Posts: 1441
|
|
As Nathan said, it depends on the context. If you are looking at it from a language perspective (C++, Java), then the answer is no. If you are talking about interfaces or object interactions then the return type is usually considered part of the signature. This assists in preventing statements like "It returns an int? I'm expecting an array of doubles!" occuring too often. John
|
The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
|
 |
 |
|
|
subject: Method signature
|
|
|