Hi Sir's,


I have taken one class with two overloading methods i.e same method name
with different number of arguments and i invoke with instance of class i
got wrong number of arguments error. please see the below code......

class Person

  def print_details(name)
    "Hey My Name is #{name}"
  end

  def print_details(name,age)
    "Hey My Name is #{name} and #{age}"
  end
end

person1 = Person.new
puts person1.print_details("peter")
puts person1.print_details("pk",25)

 I got The error  wrong number of arguments (1 for 2) (ArgumentError).

  Why Ruby does not support the method overloading ???

  Could u please explain me reason????

Thanking You in Advance........

-- 
Posted via http://www.ruby-forum.com/.