开发者

Why cannot c# or c++ differentiate methods based on return type? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Function overloading by return type?

If I have two methods:

myClass mc = new myClass();

double d = mc.GetPoint();
int i = mc.GetPoint();

Why cannot the C# or C++ compilers differentiate these functions from their return type? I would have though the return type would be开发者_开发问答 part of the signature of the method, just like any method arguments are.

Why can't the compilers handle this?


C# supports dynamic typing like when you use var. How then is the compiler supposed to know which method it should call?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜