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?!
string? Why is this information missing from your question?std::stringjudging by the code, however this isn't really an Arduino question but a C++ question which might be better asked at Stack Overflow. I see people are voting to close this question, and if it gets closed just ask at Stack Overflow. They are experts on C++. :)