What is an ignored qualifier? Well, in a class, lets have a student class: #include <string> class Student { public: const std::string Name; private: bool m_Present; public: Student(const std::string& p_Name) : Name(p_Name), m_Present { } void SetPresent() { m_Present = true; } void SetAbsent() { m_Present = false; } }; Now, we may want to access the present flag, therefore provide a function to do so: bool Present() const { return m_Present } This function is telling the user of our class quite a bit, it tells them that the return type is boolean and that the calling of this function makes no changes to the class contents (const trailing the parameter list). However, for me, this isn't quite right, I believe that we want to inform any user that the boolean returned is also constant, it does not change unless you alter the internal value with the "Set
Comments
Post a Comment