#include < iostream. h>
class Class
{
public:
void print(int a,int b) {
cout< < ″int:″ < < a < < endl;
cout < < ″int:″ < < b < < endl;
}
void print(char * a,char * b) {
cout< < ″string:″ < < a < < endl;
cout < <″ string:″ < < b < < endl;
}
void print(char * a,unsigned int b){
cout < < ″string:″ < < a < < endl;
cout < < ″int:″ < < b < < endl;
}
};
void main()
{
Class cls;
cls. print(10,20);
cls. print(′c′,1);
cls. print(′x′,′y′);
cls. print(″Hello!″,0);
}
CLS.PRINT("HELLO!",0);
不明确的重载函数调用,C++语言的编译器无法判断第二个值是空字符串NULL还是整数0