4 ms·
And ruby has a nice solution for this. It allows methods ending in = to act as setters clean overrides and provides methods (attr_accessor and friends) to gener
by epochwolf 16y ago
And ruby has a nice solution for this. It allows methods ending in = to act as setters clean overrides and provides methods (attr_accessor and friends) to generate vanilla getters and setters for you. You can access instance variables via instance_variable_get but that's not recommended.
- Xuzz 16y agoObjective-C is similar -- you have "setters" and "getters", but since there is no direct ivar access and you have the convenient @property syntax, you end up with a reasonably similar end result.
- ryanpetrich 16y agoThere is direct ivar access, but no sane person uses it outside of the class itself :P