C# accessor - Accessors in c# - c# - c# tutorial - c# net
Accessor Methods - gets in c# :
- Because of encapsulation, those variables are generally private
- However, the outside world may need to use those variables
- The class implementor may choose to add a "get" method to return the value
- getName(), getAddress(), getPhone(), getBalance()
Accessor Methods - sets in c# :
- The class implementor may choose to implement a set method.
- The responsibility of the set method is to set the appropriate variable
- WHILST MAINTAINING data integrity of the object.
- setName(), setAddress(), setPhone(), setBalance()