From: Jim Freeze Date: 2001-05-15T07:02:48+09:00 Subject: [ruby-talk:15121] initialize overload Ok, the synapsis aren't firing so well today. How do I overload a constructor to get the effect: m1 = Myclass.new(some_object) m2 = Myclass.new("text", "number") I cannot do: class Myclass def initialize(o) # use o end def initiaize(type, level) # use type and level end end Do I have to do something like: class Myclass def initialize(a, b=nil) if Type == a.type #do this else #do that end end end Thanks ========================================================= Jim Freeze jim@freeze.org --------------------------------------------------------- No comment at this time. http://www.freeze.org =========================================================