本文来自:http://zq2007.blog.hexun.com/8625800_d.html一些成员函数改变对象,一些成员函数不改变对象。例如: int Point::GetY(){return yVal;} 这个函数被调用时,不改变Point对象,而下面的函数改变Point对象: void Point:: SetPt (int x, int y){xVal=x;yVal=y;} 为了使成员函数的意义更加清楚,我们可在不改变对象的成员函数的函数原型中加上const说明: class Point { public:int GetX() const;int GetY() const;void Read More
posted @ 2011-04-12 09:45 BloodAndBone Views(6575) Comments(0) Diggs(1) Edit