错误 1 错误 C3867:"命令::getSecondWord":函数调用缺少参数列表;使用 '&' 创建指向成员的指针
Error 1 error C3867: 'Command::getSecondWord': function call missing argument list; use '&' to create a pointer to member
我真的快要完成我的项目了,但我遇到了一个错误,我简直无法理解。
它告诉我使用&签名以创建指向成员的指针。
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
所以基本上我有一个eat函数,它接收一个字符串,它将字符串存储在tempstring中,然后使用isItemInventory()返回一个数字。这个数字告诉我们该物品试图吃的向量"库存"中的abouts所在的位置。一旦我们有了这个数字,我们就会创建一个本地布尔值,并对该项调用getEdible。这应该返回true或false,但我却收到了一个关于使用指针的错误?有人能帮我吗?
您可能想要:
bool edible = inventory[checker].getEdible();
// ^^ parentheses are needed to call a function
相关文章:
- C++使用params创建线程函数会导致转换错误
- 为什么加载SDF会导致Mobilizer创建闭环错误
- 此代码编译良好,但文件未创建?请指出错误
- 为什么创建友元类的实例会导致"undefined reference to"错误?
- 创建结构的数组时遇到分段错误
- 在C++中创建队列 - 什么是 malloc 错误?
- gSoap在从.wsdl创建.h期间出现错误
- 在函数中使用 const int size 参数创建数组会在 Visual Studio 中抛出错误 C++:表达式的计
- 使用带有 ref 参数的成员函数创建线程时出现编译错误
- 尝试创建表会给出 SQL 逻辑错误
- 使用Visual Studio在虚幻引擎中创建一个新的类c ++给了我太多的错误
- 链接错误,包括我创建的相同头文件 - C++
- cout 新创建的对象引发运行时错误
- 尝试在 c++ 中创建随机数生成器并收到错误
- 创建服务失败0x6f7存根收到错误数据
- 创建 QtChart 对象会在运行时创建EXC_BAD_ACCESS错误
- gcc 找不到 -lgcc, g++.exe: 错误: 创建进程: 没有这样的文件或目录
- Linux/QT-错误创建SSL上下文(错误:140A90C4 ..)
- 堆栈内存错误创建核心文件
- 访问被拒绝错误 - 创建文件