From: Vitit Kantabutra Date: 2011-11-27T16:38:04+09:00 Subject: question about overloading Back in 2007, somebody posted a question asking whether or not it is possible to overload the constructor in Ruby. Someone else answered that it is not possible to overload any method, not just the constructor. Indeed, when I tried to overload the constructor in my own code it did not work. However, in the code for fxruby's FXRegion class, the initialize method is indeed overloaded, and it works! Why is that? Does it have something to do with the Module? Here is the code and the Web site from whence it came: module Fox class FXRegion # Construct new empty region def initialize; end # Construct new region copied from region _r_ (another FXRegion instance). def initialize(r); end # Construct new region from rectangle _rect_ (an FXRectangle instance) def initialize(rect); end # # Construct rectangle region, where (_x_, _y_) are the coordinates of the # upper left-hand corner and (_w_, _h_) are its width and height. # def initialize(x, y, w, h); end # # Construct polygon region from an array of points. Here, _points_ is # an array of FXPoint instances. # def initialize(points, winding=false); end http://www.koders.com/ruby/fid71E82B9184726294068BA353AB7E6C68DA98E25B.aspx?s=socket Another question: Why are there semicolons in the code? Is this really Ruby? -- Posted via http://www.ruby-forum.com/.