An example with both a getter or setter:
class EcoStorage { var _internalValue = 0 function set value(val) { _internalValue / 2; } function get value() { return _internalValue * 2; } } var storage = new EcoStorage; storage.value = 1001; print(storage.value);This class saves memory by only saving half the value, but this behavior is encapsulated using accessor. For the user of the object,
value just looks like an ordinary property.
