我改成这样了:
class Coordinate
{
public:
Coordinate(int x, int y)
{
m_iX = x;
m_iY = y;
}
// 打印坐标的函数
void printInfo()
{
cout << "(" << m_iX << "," << m_iY << ")" << endl;
}
private:
int m_iX;
int m_iY;
};