关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。
想改进这个问题?将问题更新为 on-topic对于堆栈溢出。
2年前关闭。
Improve this question
我正在尝试解决平衡括号问题,在我的代码中,如果我的堆栈顶部为空,我试图从函数 is_empty() 中获取 1,但是我在这里遇到了这个丑陋的错误。
int is_Empty()
{
int x=0;
if (top==NULL)
{
x=1;
}
return x;
}
这是我如何接受它
if (s1.is_Empty==1)
{
cout<<"matched"<<endl;
}
我的错误日志
bal.cpp:112:20: error: invalid use of member 'int stack::is_Empty()' (did you forget the '&' ?)
if (s1.is_Empty==1)
~~~^~~~~~~~
最佳答案
if (s1.is_Empty==1)
这不是调用函数的方式。
这里:
if (s1.is_Empty()==1)
您可能希望查看您的 C++ 书籍。
关于c++ - "invalid use of member"尝试使用我的功能时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57697609/