在子类里,我们可以通过重载父类方法来改变实体的行为. ruby> class Human | def identify | print “I’m a person.\n” | end | def train_toll(age) | if age < 12 | print “Reduced fare.\n”; | else | print “Normal fare.\n”; | end | end | end nil ruby