Created
April 10, 2011 06:59
-
-
Save luckydev/912115 to your computer and use it in GitHub Desktop.
explicitly putting parenthesis to forward arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module A | |
def say_hi(a,b,c) | |
puts "Hi, from [A] module. Numbers - #{a} #{b} #{c}" | |
end | |
end | |
class B | |
include A | |
def say_hi(a,b,c) | |
puts "B is saying Hi.. " | |
# explicitly putting parenthesis - this will send no arguments | |
super() | |
end | |
end | |
b = B.new | |
b.say_hi(1,2,3) | |
#output | |
B is saying Hi.. | |
super.rb:2:in `say_hi': wrong number of arguments (0 for 3) (ArgumentError) | |
from su.rb:14:in `say_hi' | |
from su.rb:19:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment