简体   繁体   English

错误1错误C3867:'Command :: getSecondWord':函数调用缺少参数列表; 使用“&”创建指向成员的指针

[英]Error 1 error C3867: 'Command::getSecondWord': function call missing argument list; use '&' to create a pointer to member

I'm really close to finishing my project, but i'm running into an error that I just can't wrap my head around. 我真的快要完成我的项目了,但是我遇到了一个错误,就是无法解决问题。

It's telling me to use & sign to create a pointer to member. 它告诉我使用&sign创建指向成员的指针。

void Inventory::eat(string food){
//takes in the string stores it in temp string  call isitemin inventory to return an int
//use that int to return isEdible, int = 2 means your checking at pos 2
//if edible remove from inventory and add 2hp
string tempString = food;
int checker=isItemInventory(tempString);
bool edible = inventory[checker].getEdible;
if (!edible){
    cout << "you can't eat " + food << endl;
}
else//ended here for now

So basically i have an eat function that takes in a string, it stores the string in tempstring and then uses isItemInventory() to return a number. 所以基本上我有一个eat函数,它接受一个字符串,它将字符串存储在tempstring中,然后使用isItemInventory()返回一个数字。 This number tells us where abouts in the vector "inventory" that the item were trying to eat is located. 这个数字告诉我们试图吃的物品在“库存”向量中的位置。 Once we have that number we create a local boolean and call getEdible on the item. 获得该数字后,我们将创建一个本地布尔值,并在该项目上调用getEdible。 this should return true or false but instead i'm getting an error about using a pointer ? 这应该返回true或false,但是我收到有关使用指针的错误? can anyone help me out ? 谁能帮我吗 ?

You probably want: 您可能想要:

bool edible = inventory[checker].getEdible();
                                       // ^^ parentheses are needed to call a function

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误C3867:函数调用缺少参数列表 - error C3867: function call missing argument list C ++排序对象向量,得到错误C3867函数调用缺少参数列表? - C++ sorting a vector of objects, getting error C3867 function call missing argument list? std :: vector for_each错误C3867函数调用缺少参数列表 - std::vector for_each error C3867 function call missing argument list 错误C3867:函数调用缺少参数 - Error C3867: Functional call missing argument C3867:&#39;_com_error :: Description&#39;:非标准语法 使用“&”创建指向成员的指针 - C3867 : '_com_error::Description': non-standard syntax; use '&' to create a pointer to member std::unordered_map 中的 std::function,错误 C3867 非标准语法; 使用 '&amp;' 创建指向成员的指针 - std::function in std::unordered_map, error C3867 non-standard syntax; use '&' to create a pointer to member 尝试使用指向函数的指针将模板化 class 的方法传递给另一个 class 时,出现错误 C3867 使用“&”创建指向成员的指针 - While trying to pass a method of a templated class to another class using pointer to functions,get Error C3867 use '&' to create a pointer to a member Visual Studio 2015 错误 C3867 &#39;Rectangle::get_area&#39;:非标准语法; 使用“&amp;”创建指向成员的指针 - Visual Studio 2015 Error C3867 'Rectangle::get_area': non-standard syntax; use '&' to create a pointer to member “错误C3867:非标准语法; 使用虚拟流操纵器时,使用“&”创建指向成员的指针” - “Error C3867: non-standard syntax; use '&' to create a pointer to member” when using virtual stream manipulator C ++:成员函数指针-错误C3867 - C++ : member function pointers - Error C3867
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM