- 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)
- Class member access
- Default private
- Explicitly set to private, public, protected
- Access to class's private data
- Controlled with access functions (aaccessorymethods)
- Get function; Read private data
- Set function; Modify private data
Figure 1.11:
private members of a class are not accessible outside the class.
|
Figure 1.12:
SalesPerson class definition
|
2004-12-28