3
我正在查看一些开源代码,无法将此代码包裹在此代码片段中。从Java的角度来看,Ruby中的'self'和'new'是什么意思?
class Something
def self.smart
new.smart
end
def smart
"test"
end
end
class Other < Something
println Other.smart
代码是否每次尝试实例化一个新实例smart
被调用?