From: dblack@... Date: 2002-12-20T16:27:35+09:00 Subject: Re: can initialize b overloaded Hi -- On Fri, 20 Dec 2002, Sambasivan LokeshKumar wrote: > class Point > > attr:x_pos,true > attr:y_pos,true > > def initialize(x_pos,y_pos) > ... > end > > #can initialize b overloaded! > > def initialize(some_instance_of_point) > > @x_pos=some_instance_of_point.x_pos > ... > end > > end > > 1) Is the above snippet of code valid one in Ruby > If not why? It's valid, but it's not overloading: it's overriding. The most recently defined method of a given name will be called, so your first definition of #initialize will be discarded. There's a lot of discussion of method overloading, multiple dispatch, etc. in the ruby-talk archive (http://www.ruby-talk.org). (Mainly discussion of why Ruby doesn't have them :-) > 2) How to comment multilines? =begin ... =end or multiple #'s. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav