From: "David A. Black" Date: 2009-11-28T16:26:02+09:00 Subject: Re: Class variables, instance variables, singleton; Ruby v. C++ Hi -- On Sat, 28 Nov 2009, Steve Wilhelm wrote: > Ralph Shnelvar wrote: >> Newb here coming from C++ >> >> Ok, I _think_ I know what a class variable is. It is similar to a >> static variable in a class in C++. Rght? >> >> An instance variable is apart of an instantiated class, right? >> >> What's a singleton? I don't think it's the same as as singleton in >> C++ parlance. >> >> - - - >> >> If Class X wants to access a class variable and/or constant in Class Y, >> must a class >> method be defined or is there a direct way to do it? >> >> Besides the Pickaxe book, can anyone recommend a document that >> describes this a bit more clearly? > > > 'The Ruby Programming Language' by Flanagan and Matsumoto describes the > differences between class variables and class instances variables. Don't > know if it will be any clearer than 'Programming Ruby' by Thomas, > Fowler, and Hunt. And of course this is one of the (many) problems with class variables: they make obscure the otherwise rather simple notion that classes can have instance variables because classes are objects and any object can have instance variables. David -- THE COMPLEAT RUBYIST, Ruby training with Black/Brown/McAnally! January 22-23, Tampa, Florida Info and registration at http://www.thecompleatrubyist.com -------------------------------------- My new job: http://tinyurl.com/yfpn9hz