Why Function Overloading does not depend on the return type?

Why Function Overloading does not depend on the return type?
One reason I can think of is that you can omit the return value of a function.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
int abc(int x, int y)
{
    //...
    return 0;
}

double abc(int x, int y)
{
    //...
    return 0.0;
}

int main()
{
    //...
    abc(1,2); //which one?
    //...

    return 0;
}
overloading do not allow overloading by return type. What this means is that methods can be overloading only if they differ by parameters. As with C++, a method's return type is not considered part of the method signature.

However, CIL does support overloading methods by return types, even though C# and VB.NET do not.

k thanks i got it
Topic archived. No new replies allowed.