【发布时间】:2012-02-01 17:51:03
【问题描述】:
我有一个这样的对象
class SomeObject
def initialize &block
# do something
end
end
class AnotherObject < SomeObject
def initalize &block
super
# do something with block
end
end
当在AnotherObject 中调用super 时,该块似乎被传递给SomeObject。这是正确的行为吗?是否存在?
【问题讨论】:
-
你不需要这种行为吗?
标签: ruby inheritance super ruby-1.9.3