From bee5e87e900f25b6457809c7e411b157686dadec Mon Sep 17 00:00:00 2001 From: Sergey Zubkov Date: Mon, 30 Jan 2017 06:47:00 -0500 Subject: [PATCH] C.131: getters should be const member functions --- CppCoreGuidelines.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index f4caec2..d07af82 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -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 };