C++ 错误C3867';数据库::isUserAndPassMatch';:非标准语法;使用'&';创建指向membe的指针
我想弄明白有一段时间了,但找不到解决办法 当我在另一个cpp文件中写入此代码行时:C++ 错误C3867';数据库::isUserAndPassMatch';:非标准语法;使用'&';创建指向membe的指针,c++,C++,我想弄明白有一段时间了,但找不到解决办法 当我在另一个cpp文件中写入此代码行时: if(DataBase::isUserAndPassMatch(u->getUsername(), " ")){} 我得到错误C3867。我试图将u->getUsername()切换为空字符串(“”),但仍然出现相同的错误。我也试过: if(&DataBase::isUserAndPassMatch(u->getUsername(), " ")){} isUserAndPassMatch
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() ) {
}
试试看。您在代码的第一位缺少一个
)
。应该是if(DataBase::isUserAndPassMatch(u->getUsername(),“”)
yep,刚刚看到它。但是我没有解决这个问题