A member function is a function working on a class.
There are multiple types of member functions:
- const member functions: these do not change the (non-mutable) member variables
- static member functions: these do not have access to an object
- member function example 1: Hello World
- member function example 2: function pointer to member function
- Follow a standard member function design. Note: many points of advice!
- Calling a member function a 'method' is wrong [1]
- Always try to localize the effects of change to a class's data members by accessing and manipulating the data members through their corresponding get and set functions [2]
- Stephen C. Dewhurst. C++ Gotchas. 2003. ISBN: 0-321-12518-5. Gotcha #9: 'Wrong: method, right: member function'
- Paul Deitel, Harvey Deitel. C++11 for programmers (2nd edition). 2014. ISBN: 978-0-13-343985-4. Chapter 3.4, Good Programming Practice 3.1. page 50: 'Always try to localize the effects of change to a class's data members by accessing and manipulating the data members through their corresponding get and set functions'