void printOutput(std::string text);
void printOutput(std::string& text);
两个函数打印一些文本到控制台,但我想处理各种情况,其中:解决方法不明确调用重载函数
std::string testOutput = "asdf";
output->printOutput(testOutput); // Gives the error as it can use either function
在某些情况下,我可能会想:
output->printOutput("asdf"); // Only the first function can be used
相对于这一切而言,有没有一种方法可以解决这个问题?
这两个函数做了不同的事情_besides_输出? –