Function Overloading

前端 未结 6 1128
死守一世寂寞
死守一世寂寞 2020-12-16 16:47

Let us suppose i have these three methods defined:

int F1(int, int);
int F1(float, float);
Float F1(int, int);

and i am calling method F1 h

6条回答
  •  情深已故
    2020-12-16 17:39

    Have you tried it?

    You would think it should execute either:

    int F1(int, int);
    

    or

    Float F1(int, int);
    

    Function overloading, however, doesn't work on return values - it's the parameter types that have to be unique, so this wouldn't even compile.

提交回复
热议问题