这是我的后增量运算符重载声明。
loc loc::operator++(int x)
{
loc tmp=*this;
longitude++;
latitude++;
retrun tmp;
}
我的类构造函数
loc(int lg, int lt)
{
longitude = lg;
latitude = lt;
}
在主要功能中,我编写了如下代码
int main()
{
loc ob1(10,5);
ob1++;
}
编译时,我收到以下错误
opover.cpp:56:5:错误:'loc loc::operator++(int)' 的原型与类'loc' opover.cpp:49:5 中的任何内容都不匹配:错误:候选者是:loc loc::operator++( ) opover.cpp:在函数'int main()'中:opover.cpp:69:4:错误:没有为后缀'++'声明'operator++(int)'</p>