in this code:
void AdptSendReply(const char* str)
{
string s(strlen(str) + 2);
s = str;
AdptSendReply(s);
}
void AdptSendReply(const string& str)
{
string s(str.length() + 2);
AdptSendReply(s); // use the next one
}
void AdptSendReply(string& str)
{
if (AdapterConfig::instance()->getBoolProperty(PAR_LINEFEED)) {
str += "\r\n";
AdptSendString(str);
}
else {
str += "\r";
AdptSendString(str);
}
}
i think c++ use of overloading ability.but how it can recognize which of the two functions "void AdptSendReply(string& str)" or "void AdptSendReply(const string& str)" must use?!