This is my post increment operator overloading declaration.
loc loc::operator++(int x)
{
loc tmp=*this;
longitude++;
latitude++;
retrun tmp;
}
My class constructor
loc(int lg, int lt)
{
longitude = lg;
latitude = lt;
}
In main function, I have coded like below
int main()
{
loc ob1(10,5);
ob1++;
}
While compiling this , i am getting the below error
opover.cpp:56:5: error: prototype for ‘loc loc::operator++(int)’ does not match any in class ‘loc’ opover.cpp:49:5: error: candidate is: loc loc::operator++() opover.cpp: In function ‘int main()’: opover.cpp:69:4: error: no ‘operator++(int)’ declared for postfix ‘++’
loc::operator++(int x)
declared in opover.h? – Tio Pepe