[#1026] Is this a bug? — Dave Thomas <Dave@...>

18 messages 2000/01/03

[#1084] Infinite loop — Dave Thomas <Dave@...>

17 messages 2000/01/11

[#1104] The value of while... — Dave Thomas <Dave@...>

24 messages 2000/01/11

[ruby-talk:01125] Class variables...

From: David Suarez de Lis <excalibor@...>
Date: 2000-01-12 09:19:36 UTC
List: ruby-talk #1125
Hi all,

I am brand new to Ruby's world, but I find it pretty interesting... :)

I have a doubt, though, I haven't been able to solve through testing or documentation...

Say I have a class person and a variable @population.

class Person
    @population = 0
    def new(the_name = nil)
        @name = the_name
        @Person::population += 1
    end
end

Ie. I want to be able to access that class variable from objects... Also, I assume END {} allows us to put conditions for GC? Like END { @Person::population -= 1 }

thanks for your help,
d@
-------------------------------------------------------------
Mensaje enviado gracias al correo gratuito de Demasiado Corp.
[http://correo.demasiado.com]
-------------------------------------------------------------

			   

In This Thread

Prev Next