Accept all types as argument in function

前端 未结 5 1021
走了就别回头了
走了就别回头了 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:07

    I'm not sure what you're trying to accomplish, but you can pass a void pointer as a parameter.

    void foo(void* bar);
    

提交回复
热议问题