摘要:
Ruby的内部类结构Array.class # => ClassClass.class # => Classsuperclass 查看父类Array.superclass # =>ObjectObject.superclass # =>BasicObjectBasicObject.superclass # => nilancestors 查看当前类的继承链Array.ancestors # => ... 阅读全文
摘要:
继承示例# inheritanceclass User attr_accessor :name, :age def initialize name, age @name, @age = name, age end def panels # ||= 操作符, 如果变量不存在 那么就赋值 @panels ||= ['Profile', 'Products'] endendc... 阅读全文