Re: Why can't overloads take into account the return type.



"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


.



Relevant Pages

  • Re: Why cant overloads take into account the return type.
    ... > int Parse ... let's pretend that we also have some overloaded methods that take ... void Print ... Besides not having any clue which Printand which Parseto use, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Whats Wrong With This Code (A bug perhaps!)
    ... a bad idea to have ambiguous calls to overloaded methods anyway. ... the compiler rules are explicit, people reading the code should be able to ... public override void Foo ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Not getting process state
    ... you have any clue on that?? ... Gilles Kohl wrote:. ... I am starting a process and I need to monitor it (wait and check if its still responding). ... void Exited ...
    (microsoft.public.dotnet.languages.csharp)
  • pointer to function solves bug ?
    ... the following is some abstractization of it: ... void setit ... the assignment doesn't work (have no clue why, ... when I invoke it from b.c as follows: ...
    (comp.lang.c)
  • One extra line every time...
    ... I had no clue due in no small ... void printFile() ...
    (comp.lang.cpp)

Loading