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

html - Cut text on left side inside button while centering -

What design pattern is this code in Javascript? -

java - Last square of 8x8 grid not drawn, using two nested FOR loops -