Re: Why can't overloads take into account the return type.
- From: "Michael C" <mculley@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 13 May 2005 09:53:00 +1000
"mdb" <m_b_r_a_y@c_t_i_u_s_a__d0t__com> wrote in message
news:Xns9654C594F8C15mbrayctiusacom@xxxxxxxxxxxxxxxx
> Because the function call and assigning the result are two completely
> different things.
In VB6 the return value was just another parameter under the hood. The
actual return value was the error code, which I presume is the same in C#.
Someone correct me if i'm wrong.
> You don't even have to assign the result. So, tell
> me... For example, what would happen if I did these:
In any of those cases it would give an error in exactly the same way as it
would if it couldn't resolve an overload. See code below.
> I'm sure you can see how ridiculous this would get if it did consider
> return type...
Not at all. In this case the developer has chosen to have the return type
part of the signature by creating 2 overloads with the only difference being
the return type. Because it can be turned on and off I can't see any problem
with it.
Michael
[STAThread]
static void Main()
{
DoIt(null);
}
static void DoIt(Class1 SomeValue)
{
}
static void DoIt(Class2 SomeValue)
{
}
.
- Follow-Ups:
- Re: Why can't overloads take into account the return type.
- From: Alan Pretre
- Re: Why can't overloads take into account the return type.
- From: Mike Schilling
- Re: Why can't overloads take into account the return type.
- References:
- Prev by Date: Re: my modified timer program
- Next by Date: re help with array of functions more info
- Previous by thread: Re: Why can't overloads take into account the return type.
- Next by thread: Re: Why can't overloads take into account the return type.
- Index(es):
Relevant Pages
|