From: Daniel Lucraft Date: 2007-05-02T00:49:36+09:00 Subject: Re: simple subclass question Ball, Donald A Jr (Library) wrote: > If I want a class and its children to have different values for the same > class variables, how would I go about making that happen? > > - donald Instead of: class A def A.var=(v) @@var = v end def A.var @@var end end class B < A end where A and B will share the class variable, use a class instance variable instead: class A def A.var=(v) @var = v end def A.var @var end end class B < A end where A and B will have different class instance variables. You can use the attr_accessor notation to create class instance variable getters and setters like this: class A class << self attr_accessor :var end end best, Dan -- Posted via http://www.ruby-forum.com/.