开发者

Does C has function overrides? [duplicate]

开发者 https://www.devze.com 2023-02-05 01:04 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: function overloading in C
This question already has answers here: Closed 12 years ago.

Possible Duplicate:

function overloading in C

So I wonder if we can use something like void A(){} and void A(开发者_开发百科int b){} in same code file?


That's not function overriding, but function overloading.

Anyway no, C doesn't provide it.

The rationale (well, one of them, the one I prefer) is that to provide function overloading you should find a way to give a symbol to a function based also on its parameters, not only on its name.
This would cause a few problems that a low-level language as C wouldn't take.

0

精彩评论

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

关注公众号