I'm creating an equivalent to JavaScript's console.log in C++, but am unsure how to have my function expect different types of arguments.
In JavaScript:
function print(arg)
{
if(typeof arg=="number") { ... }
if(typeof arg=="string") { ... }
}
Of course, JavaScript doesn't care what you give a function, but C++ does, so how can I have it catch any ( or at least specify types for it to accept ), to be handled later in the function itself?
All I have so far:
void print(string input)
{
cout << input << "\n";
}