Accept all types as argument in function

前端 未结 5 1019
走了就别回头了
走了就别回头了 2020-12-15 09:41

How can I in C++ make a function accept every Object, so I can give it numbers, String or other Objects. I am not very well in C++, I hope it\'s not a totally stupid questio

5条回答
  •  执念已碎
    2020-12-15 10:00

    If I understood you correctly you might wanna try using templates http://en.cppreference.com/w/cpp/language/function_template

提交回复
热议问题