c++ - Function that accepts every type of argument -


this question has answer here:

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

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -