系统如何判断出来我是要调用前置++,还是要调用后置++?
Coordinate &operator-(Coordinate &coor)
{
coor.m_iX = -coor.m_iX;
coor.m_iY = -coor.m_iY;
return coor;
}
Coordinate &Coordinate::operator++()
{
++m_iX;//m_iX++;
++m_iY;//m_iY++;
return *this;
}
Coordinate Coordinate::operator++(int)
{
Coordinate old(*this);
this->m_iX++;
this->m_iY++;
return old;
}
如题,在类中分别重载了前置++和后置++,那么问题来了,在main函数中,怎么样的调用才被编译器视作调用前置++,怎么样的调用系统会自动调用后置++?或者说,当同时重载了前置++和后置++时,如果在main函数中调用coor1++或++coor1,系统怎么判断我是要调用前置++函数还是后置++函数?