public:
Coordinate(int x,int y):m_iX(x),m_iY(y)
{
}
void printInfo()
{
cout<<"("<<m_iX<<","<<m_iY<<")"<<endl;
}
int main(void)
{
Coordinate coorArr[2]={Coordinate(1,2),
Coordinate(3,4)};
//遍历数组,打印对象信息
for(int i = 0; i < 2; i++)
{
coorArr[i].printInfo();
}
return 0;
}
Coordinate(int x,int y):m_iX(x),m_iY(y)
{
}
void printInfo()
{
cout<<"("<<m_iX<<","<<m_iY<<")"<<endl;
}
int main(void)
{
Coordinate coorArr[2]={Coordinate(1,2),
Coordinate(3,4)};
//遍历数组,打印对象信息
for(int i = 0; i < 2; i++)
{
coorArr[i].printInfo();
}
return 0;
}