23
我有一個類:構造覆蓋
class One
def initialize; end
end
我需要建立一個新的類和我自己的構造是這樣的:
class Two < One
def initialize(some)
puts some
super
end
end
Two.new("thing")
但是當我啓動代碼,我得到了一個錯誤:
thing
test.rb:10:in `initialize': wrong number of arguments (1 for 0) (ArgumentError)
的文檔:[超](http://apidock.com/ruby/Class/superclass)在apidock – 2013-07-08 04:52:25