From: "Hal E. Fulton" Date: 2001-07-10T12:19:53+09:00 Subject: [ruby-talk:17587] Re: perfect newbie ----- Original Message ----- From: Serban Udrea To: ruby-talk ML Sent: Monday, July 09, 2001 7:00 PM Subject: [ruby-talk:17581] perfect newbie > Hello everybody, > > I'm a total newbie to OOP and Ruby. Actually I want to learn how to do OOP and choose Ruby because I read that it's a nice > OOP programming language and it's also good for beginners like me. Freundliche gruessen und willkommen! If I spelled any of that right... > I have for the moment a problem with the "class instance variables". > > There is the folowing written in the FAQ: > > "There is no way to access class instance variables from instance methods." Without re-reading the FAQ, I think you are confusing what we normally just call an "instance variable" with a "class instance variable." This terminology is less than ideal. In fact, some of Ruby's terminology breeds confusion sometimes, IMO. class Foo @@var1 = nil @ var2 = nil def mymeth @var3 = nil end end Here, note that @@var1 is a class variable, @var3 is an instance variable, and @var2 is a class instance variable. @var2 does not belong to any instance of Foo, nor yet to foo itself, but to the class of Foo, which is Class. Have I said that wrong and embarassed myself? :) Hal