From: Shuaib Zahda Date: 2007-10-22T14:17:59+09:00 Subject: How does overload work in ruby? Hello guys I was trying to overload one method but it does not work like Java. I noticed it only uses the first method that it meets. is there any special way for overloading in ruby. class Overloading def sum(a, b) return a + b end def sum(a, b, c) return a + b + c end end obj = Overloading.new puts obj.sum(5, 7) puts obj.sum(5, 6, 7) the output overloading.rb:13:in `sum': wrong number of arguments (2 for 3) (ArgumentError) from overloading.rb:13 any idea? Regards Shuaib -- Posted via http://www.ruby-forum.com/.