C++ examples for Class:Member Function
Demonstrate const member functions
class aClass// w w w .j av a 2s .c o m { private: int alpha; public: void nonFunc() //non-const member function { alpha = 99; } //OK // void conFunc() const //const member function // { alpha = 99; } //error: can't modify a member }; int main() { return 0; }