From: Ron Hopper Date: 2007-03-23T02:04:15+09:00 Subject: Re: What is the problem with this module function. ------=_Part_223868_17303872.1174583053872 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 3/22/07, SunRaySon wrote: > > > I am expecting it to print ModuleA::foo because the method foo in > ModuleA would overwrite the method foo when I include ModuleA after > reopening the class A later. Am I missing something here, can anyone > help me understand this. > > Kiran Kumar > > Kiran, You are mistaken about the method lookup precedence in Ruby. The method is first looked up in the class, then mixin modules, then superclasses, etc. Therefore, the class definition of "foo" is masking the module definition of "foo", not the other way around. - chopper ------=_Part_223868_17303872.1174583053872--