Closed. This question needs details or clarity。它当前不接受答案。












想改善这个问题吗?添加详细信息,并通过editing this post阐明问题。

6年前关闭。



Improve this question




我有一个需要两个变量的函数:
call((void**) &var, float);
call((void**) &var, int);
call((void**) &var, string);

现在,我想创建一个函数来调用该特殊函数:
function start_call(/*what to put here?*/)
{
    call((void**) &var1, float);
    call((void**) &var2, int);
    call((void**) &var3, string);
     //code
}

那么,在“要放在这里放什么”呢?位置,以便函数接受任何变量?

我试图让我的迷茫解释一下...

最佳答案

您可以使用模板:

template <class T> start_call(T in);

关于c++ - C++变量类型,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20434680/

10-11 22:45
查看更多