Ruby Programming/Syntax/Classes - 维基教科书,自由的教学读本
實例變數存取子(Instance Variable Accessor) 编辑] Note that object instance variables are not really private, you just can't see them. To access an instance variable, you need to create a getter and setter. Like this (no, don't do this by hand! See below ......