PPT Slide
If only have in parameters... what to do?!? Think OO!
- Data and methods are encapsulated, i.e., we want all access to, and modification of, data to belong only to the object itself via the object’s methods (provided by its class).
- Within a class, data is accessible to methods without going through parameters.
- Access from outside should be only by asking the object to “do it for you” via its methods:
- accessor ( “get” ) methods: i.e., functions that return a value
- modifier ( “set” ) methods: i.e., procedures that change data state.
- From outside the object, gain access
- Functionality of an out param
- Functionality of an in/out param
via an accessor methods (for the in)
and and a modifier (for the out).