一种是赋初值法 另一种是调用函数
Coordinate(int x, int y)
{
m_iX = x;
m_iY = y;
}
void coor(int x, int y)
{
m_iX = x;
m_iY = y;
cout << x << "," << y << endl;
}
// 打印坐标的函数
//定义对象数组
Coordinate coorArr[2] = {
Coordinate(1,2),
Coordinate(3,4)
};
//Coordinate[0].coor(1,2);
Coordinate(int x, int y)
{
m_iX = x;
m_iY = y;
}
void coor(int x, int y)
{
m_iX = x;
m_iY = y;
cout << x << "," << y << endl;
}
// 打印坐标的函数
//定义对象数组
Coordinate coorArr[2] = {
Coordinate(1,2),
Coordinate(3,4)
};
//Coordinate[0].coor(1,2);