C++的函数名重载

时间:2020-12-03 21:18:39
#include <iostream>

using namespace std;

int func(int c)
{
cout<<"int func(int c)"<<endl;
} int func(char c)
{
cout<<"int func(char c)"<<endl;
}
//函数的重载就是函数名相同,根据参数的类型决定调用哪个函数 int main()
{
int m;
char n;
func(m);
func(n);
cout << "Hello World!" << endl;
return ;
}