super方法
【super方法】super关键字是用做类的继承,主要作用是调用父类的同名方法。
```
class Car
def ability
"i can run"
end
end
```
class Plane < Car
def ability
super << "and fly"
end
end
puts Plane.new.ability
#=> "i can run and fly"
推荐阅读
- 宽容谁
- 我要做大厨
- 增长黑客的海盗法则
- 画画吗()
- 2019-02-13——今天谈梦想()
- 远去的风筝
- 三十年后的广场舞大爷
- 叙述作文
- 20190302|20190302 复盘翻盘
- 学无止境,人生还很长