void printOutput(std::string text);
void printOutput(std::string& text);
Both functions print some text out to the console, but I wanted to handle each case where:
std::string testOutput = "asdf";
output->printOutput(testOutput); // Gives the error as it can use either function
In some cases I may want to:
output->printOutput("asdf"); // Only the first function can be used
Rather new to all this, is there a way I can handle this?
Pass by const reference:
Both forms can bind to that, and you shouldn’t have to modify what you print.