c++ - Function that accepts every type of argument -
this question has answer here:
- c++ send type of argument function 3 answers
let's want create function couts value pass it, don't know whether int, or string, or….
so like:
void print(info) { cout << info; } print(5); print("text");
you can function template:
template <typename t> void print( const t& info) { std::cout << info ; }
Comments
Post a Comment