- Access modes
- private
- Default access mode
- Accessible to member functions and friends
- public
- Accessible to any function in program with handle to class object
- protected ; (discuss later)
Figure 12:
private members of a class are not accessible outside the class.
|
- Class member access
- Default private
- Explicitly set to private, public, protected
- struct member access
- Default public
- Explicitly set to private, public, protected
- Access to class's private data
- Controlled with access functions (accessor methods)
- Get function; Read private data
- Set function; Modify private data
2004-06-29