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

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

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

javascript - Chart.js - setting tooltip z-index -