From: ts Date: 2005-03-15T22:58:16+09:00 Subject: Re: [newby] class variables and class instance variable? >>>>> "W" == Wolfgang N�dasi-Donner writes: >>>>> Example >>>>> W> class Mytest W> @@n_of_Mytest = 0 svg% cat b.rb #!/usr/local/bin/ruby class Mytest @n_of_Mytest = 0 def initialize self.class.instance_eval { @n_of_Mytest += 1} end def Mytest.n_of_Mytest @n_of_Mytest end end puts Mytest.n_of_Mytest a = Mytest.new puts Mytest.n_of_Mytest b = Mytest.new c = Mytest.new puts Mytest.n_of_Mytest d = Mytest.new e = Mytest.new f = Mytest.new puts Mytest.n_of_Mytest svg% svg% b.rb 0 1 3 6 svg% -- Guy Decoux