Const Member Function in C++ Example Program

A const member function guarantees that it will never modify any of its class’s member data. The CONSTFU program shows how this works. //constfu.cpp //demonstrates const member functions / class aClass { private: int alpha; public: void nonFunc() //non-const member function { alpha = 99; } //OK void conFunc() const //const member function { alpha

Const Member Function in C++ Example Program Read More »