Coordinate()
{
}
// 打印坐标的函数
void printInfo()
{
cout<<"("<<m_iX<<","<<m_iY<<")";
}
public:
int m_iX;
int m_iY;
};
int main(void)
{
//定义对象数组
Coordinate coorArr[2];
for(int j=0;j<2;j++)
{
coorArr[j].m_iX=2*j+1;
coorArr[j].m_iy=2*j+2;
}
{
}
// 打印坐标的函数
void printInfo()
{
cout<<"("<<m_iX<<","<<m_iY<<")";
}
public:
int m_iX;
int m_iY;
};
int main(void)
{
//定义对象数组
Coordinate coorArr[2];
for(int j=0;j<2;j++)
{
coorArr[j].m_iX=2*j+1;
coorArr[j].m_iy=2*j+2;
}
class Coordinate{public:Coordinate(int x, int y){m_iX=x;m_iY=y;}void printInfo() const{cout<<"("<<m_iX<<","<<m_iY<<")"<<endl;}public:int m_iX;int m_iY;};int main(void){const Coordinatencoor(3, 5);const Coordinate*p=&coor;constCoordinate&c=coor;coor.printInfo();p>>printInfo();c.printInfo();return 0;}