From: "James G. Britt" Date: 2005-02-22T06:31:00+09:00 Subject: Re: Constructor overloading??? On Tue, 22 Feb 2005 06:04:07 +0900, Panagiotis Karvounis wrote: > Hi, > > Does Ruby support constructor overloading? No; Ruby desn't support method overloading. But you can pass a variable number of arguments and do some logic based on what's given. One approach is to define all the args and set default values: def initialize ( x, y="Hey!", z=nil ) end Another might be to just accept any number of args as an array: def initialize ( *args) # The array args now has the arguments end Or combine them def initialize (x=0, y="Hey!", *z=nil ) end Or use a hash as the primary argument: def initialize ( h={} ) # Now go look for named arguments in the hash end f = Foo.new( :user_name => "Jimbo!", :country => "Bronx" ) What are you trying to accomplish? James