From: Logan Capaldo Date: 2005-12-08T15:39:27+09:00 Subject: Re: About class methods On Dec 8, 2005, at 1:30 AM, Hank Gong wrote: > Hi! When I read the Ruby manual, I noticed that for class Array, > there are > class methods and instance methods. > > Class methods: > [] and new > > instance methods: > too many (not list here) > > My question is: what's this class methods? I remember in C++, all > methods > should be instance level, right? > Thanks! > > Yours, Hank class methods are (more or less) the same thing as static methods in C ++. eg. class A { public: static int aClassMethod { return 42; } int anInstanceMethod { return 7; } }; A::aClassMethod( ); //=> returns 42 A x; x.anInstanceMethod( ); //=> returns 7