Re: Why can't overloads take into account the return type.
- From: "Michael C" <mculley@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 13 May 2005 15:29:03 +1000
"Chris Priede" <priede@xxxxxxxxx> wrote in message
news:OGo%23%23B3VFHA.1452@xxxxxxxxxxxxxxxxxxxxxxx
> Ok. Now, let's pretend that we also have some overloaded methods that
> take different argument types, say:
>
> void Print(int i)
> void Print(double i)
>
> Now, someone comes along and writes:
>
> int x = 5;
>
> Print( x * Parse(something) );
>
> Besides not having any clue which Print() and which Parse() to use, the
> compiler doesn't even have a clue whether to use integer or floating point
> multiplication.
That's no big problem it should just give an error like it does with current
ambiguous overloads.
> The other problem with this is that it most definitely doesn't encourage
> good object oriented design.
How is that?
Michael
.
- Follow-Ups:
- Re: Why can't overloads take into account the return type.
- From: Daniel O'Connell [C# MVP]
- Re: Why can't overloads take into account the return type.
- References:
- Why can't overloads take into account the return type.
- From: Michael C
- Re: Why can't overloads take into account the return type.
- From: mdb
- Re: Why can't overloads take into account the return type.
- From: Michael C
- 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: Michael C
- 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: John B
- Re: Why can't overloads take into account the return type.
- From: Chris Priede
- Why can't overloads take into account the return type.
- Prev by Date: Confused about using Reflection to examine a collection
- Next by Date: Re: C# - Problem to receive data from a C++ Dll
- 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
|
Loading