在尝试编译我的c ++代码时,我得到了标题中提到的错误.我无法理解我在这里做错了什么.
编译器在执行bool operator==(Token )函数时遇到问题.我认为这是超载运营商的方式.
任何线索,为什么编译器不喜欢我指的
this->terminal还是this->lexeme?
class Token {
public:
tokenType terminal;
std::string lexeme;
Token *next;
Token();
bool operator==(Token &t);
private:
int lexemelength, line, column;
};
bool Token::operator==(Token &t) {
return ((this->terminal == t->terminal) &&
(this->lexeme == t->lexeme));
}
Run Code Online (Sandbox Code Playgroud)