Ruth A. Kramer
12/30/2004 2:41:00 PM
Eustaquio Rangel de Oliveira Jr. wrote:
> Thanks for your help (my brain is still hot here).
My brain is not here either (I'm fighting a headache) and I didn't
carefully read the example code, but maybe the following will help (and
maybe it's way off base).
Ruby allows you to have class variables and instance variables. If you
have a class like cars (I didn't read the example closely at all) and
instances for Ford, Honda, ..., only one class variable will exist but
instance variables will exist for Ford, Honda, .... Thus, if, for
example, you want a total over all cars, you (with suitable coding) want
to use the class variable. If you want separate totals for Ford, Honda,
..., you want to use instance variables.
Going even further out on a limb (I'm a Ruby newbie too (and <sad
attempt at a joke warning>and if you don't like my ideas, you could say
goodbye, Ruby newbie, and even write a song about it</sad attempt at a
joke warning>)), IIRC, a class variable is prefixed with @@, and
something else (maybe instance variables?) are prefixed with @.
Randy Kramer