【文件属性】:
文件名称:Ruby简洁学习笔记(二):类继承、属性、类变量
文件大小:51KB
文件格式:PDF
更新时间:2021-01-02 15:16:46
ruby 变量 学习
1.如何声明一个子类
代码如下:
class Treasure < Thing
这样Thing类中的属性name,description都被Treasure继承
2.以下三种方式传入父类initialize方法的参数分别是什么?
代码如下:
# This passes a, b, c to the superclass
def initialize( a, b, c, d, e, f )
super( a, b, c )
end
# This passes a, b, c to the superclass
def initialize( a, b, c )
super
end
#