Z
Zhao Yi
This is my class definition:
class Impl
include MyModule
def fun()
puts ("fun")
end
def fun(directory)
puts ("fun directory")
end
end
m=Impl.new()
m.fun()
When I run this program, I got this error:
class_objects/module.rb:22:in `fun': wrong number of arguments (0 for 1)
(ArgumentError)
from class_objects/module.rb:22
I declared two methods with the same name but different parameters. Why
can't ruby support overload method?
class Impl
include MyModule
def fun()
puts ("fun")
end
def fun(directory)
puts ("fun directory")
end
end
m=Impl.new()
m.fun()
When I run this program, I got this error:
class_objects/module.rb:22:in `fun': wrong number of arguments (0 for 1)
(ArgumentError)
from class_objects/module.rb:22
I declared two methods with the same name but different parameters. Why
can't ruby support overload method?