In C++ how is function overloading typically implemented?

后端 未结 8 1906
醉酒成梦
醉酒成梦 2020-12-09 04:07

If there is no function overloading, the function name serves as the address of the function code, and when a function is being called, its address is easy to find using its

8条回答
  •  再見小時候
    2020-12-09 04:42

    It is, I believe, achieved through name mangling:

    the functions you know as foo(int) and foo(double) are actually named something like int_foo() and double_foo() (or similar, I'm not entirely sure of the particular semantics employed for C++). This means that C++ symbols are usually an order of magnitude larger than the names they are given in code.

提交回复
热议问题