[#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:01925] Class Variables

From: "David Douthitt" <DDouthitt@...>
Date: 2000-03-16 21:52:24 UTC
List: ruby-talk #1925
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

etc.....  I thought I heard someone say something about "Class Variables" somewhere.  I figured out by osmosis about the "def initialization" method (didn't see THAT ONE in the UGuide or the Man.....) but it seems as if @var isn't anywhere to be found outside the Class - more of a private class variable than a public instance variable.

I might add that the chapter on "instance variables" in the User Guide is confusing (in English) - at least, to me anyway.


In This Thread

Prev Next