分享下,如果想在类里调用外部的普通同名方法,可以用::外部函数调用
如果外部方法里namespace可以命名空间::外部方法
如果外部方法里namespace可以命名空间::外部方法
2017-07-29
class Coordinate
{
public:
Coordinate(int x, int y)
{
m_iX = x;
m_iY = y;
}
public:
int m_iX;
int m_iY;
};
int main(void)
{
Coordinate *p = new Coordinate(3,5);
cout <<"(" << p->m_iX <<"," << p->m_iY << ")" << endl;
delete p;
p = NULL;
return 0;
}
{
public:
Coordinate(int x, int y)
{
m_iX = x;
m_iY = y;
}
public:
int m_iX;
int m_iY;
};
int main(void)
{
Coordinate *p = new Coordinate(3,5);
cout <<"(" << p->m_iX <<"," << p->m_iY << ")" << endl;
delete p;
p = NULL;
return 0;
}