错误 C3867 "数据库::是用户和通行证匹配":非标准语法;使用 '&' 创建指向 Membe 的指针
Error C3867 'DataBase::isUserAndPassMatch': non-standard syntax; use '&' to create a pointer to membe
我已经想了一段时间,但找不到解决方案。
当我在另一个cpp文件中写下这行代码时:
if(DataBase::isUserAndPassMatch(u->getUsername(), " ")){}
我得到错误C3867。我试图将u->getUsername()切换为空字符串("),但仍然出现相同的错误。我也试过这个:
if(&DataBase::isUserAndPassMatch(u->getUsername(), " ")){}
isUserAndPassMatch:
bool DataBase::isUserAndPassMatch(std::string username, std::string password){}
假设您有类定义:
class DataBase {
public
bool isUserAndPassMatch() {return true;}
};
如果你想调用isUserAndPassMatch成员函数,你必须有对象:
DataBase db;
if( db.isUserAndPassMatch() ) {
}
试试看。
相关文章:
- 如何创建一个CMake变量,除非显式重写,否则使用默认值
- 使用std::multimap迭代器创建std::list
- 使用CMake创建QML插件
- 为什么我不能在不创建字符串变量的情况下使用函数的字符串输出
- C++使用params创建线程函数会导致转换错误
- 为什么我不能使用 EGL 创建无头 OpenGl 上下文?
- 使用std::list创建循环链表
- 正在使用for循环创建QScatterSerie
- 使用基类指针创建对象时,缺少派生类析构函数
- 使用Bazel C++教程;build不创建/使用共享库
- 找不到如何创建使用指针、字符和 for 函数组合的程序
- 根据用户输入创建使用C 的图形
- 在 CDialog 派生类上创建使用 VS2015 CLR 返回 0,在 VC++ 6 中工作正常
- 如何创建使用重写函数的非成员函数?
- 用于创建使用XML中定义的GUI的C 本机应用程序的库
- 如何创建使用列表初始化的构造函数
- Scala:在JNI方法中创建/使用自定义类型
- 创建使用运算符的 C++ 类
- MFC:如何创建使用透明 PNG 作为后行(而不是窗口镶边)的瘦身对话框
- 创建使用Boost ASIO而不公开它的静态库