From: Harold Hausman Date: 2007-01-27T15:25:03+09:00 Subject: Re: Another Ruby language question On 1/27/07, Neville Franks wrote: > Harold Hausman wrote: > > > > The other method (b_method) is merely a method defined inside the > > module. In this case the module is acting as a namespace. If you > > 'include' this module somewhere in your code you'll be adding the > > b_method to that place (scope?) > > > > Harold, > Thanks for that. I figured I understood the use of self, but assumed it > was redundant and therefore I couldn't see the difference between > a_method and b_method. Now I get it. In my C++ world we don't qualify > methods like this. > No problemo. In comparison to C++, your a_method is (kinda sorta) like a static method, but not really, but kindof because you can use the :: syntax to call it. b_method is more like a method belonging to a class which you're inheriting. The instances of your new class can call b_method (assuming you've included Mod1) ... Ruby only supports single inheritance directly, but you can emulate multiple inheritance like this by just including multiple modules into your class... I believe the rubyists like to call this mixing-in... hth, -Harold