c++的运算符重载问题
本帖最后由 错过会难过 于 2014-8-24 15:41 编辑有两个字符串,我想要这样
if(s1 == s2)
那么重载函数该怎么写?
比较字符串每个字符,相同返回1,否则返回0 ling0 发表于 2014-8-24 15:02
比较字符串每个字符,相同返回1,否则返回0
error: 'bool operator==(const char&, const char&)' must have an argument of class or enumerated type
bool friend operator==(const char& s,const char& s1)
^
编译器是这样报错的
页:
[1]