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 - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -