阅读背景:

如何在继承类中使用重写常数

来源:互联网 

given this code:

鉴于这种代码:

class A
  CONST = 'A'

  def initialize
    puts CONST
  end
end

class B < A
  CONST = 'B'
end

A.new # => 'A'
B.new # => 'A'
class A
  CONST = 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: