#include <iostream>
#include <string>
void overloadingfunc (int i)
{
std::cout << "i: " << i << '\n';
}
void overloadingfunc (double k)
{
std::cout << "k: " << k << '\n';
}
void overloadingfunc (std::string str)
{
std::cout << "str: " << str << '\n';
}
int main(void)
{
overloadingfunc (10);
overloadingfunc (16.8);
overloadingfunc ("hello overloading function");
return 0;
}
$ ./overloading
i: 10
k: 16.8
str: hello overloading function
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |