[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:01929] Re: Class Variables

From: "David Douthitt" <DDouthitt@...>
Date: 2000-03-16 22:04:08 UTC
List: ruby-talk #1929
| "David Douthitt" <DDouthitt@cuna.com> writes:
| 
| > How do I do the equivalent of something like this....
| > 
| > Class Foo
| >     setting1 = 2;
| >     setting2 = 5;
| > 
| >     def ....
| >     def ...
| > end
| > 
| > fooey = Foo.new;
| > print fooey.setting1
| >     2
| > print fooey.setting2
| >     5
| > print fooey.setting2 + fooey.setting1
| >     7
| 
| Using class constants:
| 
|  class Foo
|    SETTING1 = 2;
|    SETTING2 = 5;
|  end
| 
|  p Foo::SETTING1
|  p Foo::SETTING2 + Foo::SETTING2

I DID find class constants (see I do read the manual! :-)

But I ALSO want to be able to do:

fooey.setting1 = 6;

...dave

In This Thread

Prev Next