From: Sean O'Dell Date: 2002-03-13T16:39:26+09:00 Subject: Re: Module Syntax "Yukihiro Matsumoto" wrote in message news:1015992093.806859.28746.nullmailer@ev.netlab.jp... > Hi, > > In message "Module Syntax" > on 02/03/13, "Sean O'Dell" writes: > > |....so just for the heck of it, I wrote this: > | > |def MyModule::MyFunction > | mycode() > |end > | > |....and it worked! > > No, it didn't work as you might expect. It defined a new method of > the MyModule module. You have to notice Ruby has clear distinction > between instance methods and class/module methods, unlik C++. > > matz. That's actually what I wanted to do. My first declaration of MyFunction was wrong, I meant it to be MyModule::MyFunction inside of the module block. So, will this work for classes too? Can class functions be declared outside of the class definition block and they get full access to all the private variables and things inside of a class? Sean