當(dāng)猴子修補(bǔ)一個方法時,你能從新的實現(xiàn)中調(diào)用被重寫的方法嗎?假設(shè)我是猴子在類中修補(bǔ)一個方法,我如何從重寫方法調(diào)用重寫的方法?比如,有點像super例如:class Foo
def bar()
"Hello"
endend class Foo
def bar()
super() + " World"
endend>> Foo.new.bar == "Hello World"
- 3 回答
- 0 關(guān)注
- 627 瀏覽
添加回答
舉報
0/150
提交
取消