C.131: getters should be const member functions

This commit is contained in:
Sergey Zubkov 2017-01-30 06:47:00 -05:00
parent 25201c82fc
commit bee5e87e90

View File

@ -6393,9 +6393,9 @@ A trivial getter or setter adds no semantic value; the data item could just as w
int y;
public:
Point(int xx, int yy) : x{xx}, y{yy} { }
int get_x() { return x; }
int get_x() const { return x; }
void set_x(int xx) { x = xx; }
int get_y() { return y; }
int get_y() const { return y; }
void set_y(int yy) { y = yy; }
// no behavioral member functions
};