当尝试将数组作为参数传递时,我得到:
"No matching function to call to ' table::retrieve(const char[16], item&, int)'
我正在尝试调用该函数
program.reference.retrieve("Abecean Longfin", program.client_item, 1);
函数是
int table::retrieve(char item_in[],item*item_list, int name_flag)
我敢肯定这很简单,我不明白,但我是新手。
最佳答案
您的调用失败的真正原因是您传递了一个item&
,而您的函数接受了一个item*
。您的代码也违反了字符串的 const 正确性,但在 C++03 中,它们有一个特殊的规则使它合法。
关于c++“没有要调用的匹配函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10679526/