#include <iostream>
using namespace std;
void test(int a)
{
cout<<"int test"<<endl;;
}
void test(float a)
{
cout<<"float test"<<endl;
}
void main()
{
test(3);
test(3.0f);
}
c++函数重载是利用名称压轧(name mangling),实际上编译器在编译的时候,已经把第一个编译成了test_i,第二个编译成了test_f
可以利用extern c来防止函数名压轧