ex:
class A
def test(num)
puts "A test #{num}"
end
end
class B <>
def test( num)
super
puts "B test #{num}"
end
end
b= B.new
b.test(2)
---> A test 2
B test 2
super will pass the parameters to superclass or module
another usage: call super will parameters to pass specific parameters
沒有留言:
張貼留言