[HELP] : ruby and the class variables

S

smayemba

Hi all,

how can i use the class variables in ruby like in Java :

class A
{
public static foo;
}

class B
{
public static bar = A.foo; //A.foo is what i am looking for to do.
}

Thanks for all

Sébastien
DESS Informatique des Systèmes Autonomes
Université Paris 8, France
 
G

gabriele renzi

Hi all,

how can i use the class variables in ruby like in Java :

beware, someone may flame you, this are static variables not class
ones.
class A
{
public static foo;
}

class B
{
public static bar = A.foo; //A.foo is what i am looking for to do.
}

Thanks for all

ruby has class variables, like this:=> 10

but these are shared with subclasses. You may use instance variables
of Class objects like this:
=> 20
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top