// class with member functions // Michael L. Collard // 10/14/99 #include using std::cout; using std::endl; // example class with member functions class MyClass{ public: int get() const; // accessor member function void set(int n); // mutator member function private: int data; }; // member function that returns the value of private variable int MyClass::get() const { return data; } // member function that sets value for private variable void MyClass::set(int n) { data = n; } int main() { MyClass ob1; ob1.set(5); cout << ob1.get() << endl; // get the state of ob1 }