From: Drew Olson Date: 2007-08-02T23:56:36+09:00 Subject: Re: Beginner's tutorial and poor attempt at classes Drew Olson wrote: > Gabriel Dragffy wrote: >> I still struggling >> with trying to identify the differences between self.???, @, and @@. > > Gabriel - > > I'll take a crack at trying to help you with these symbols. Whoops! I should not be resetting the class variable inside initialize! It doesn't effect the output of the previous example, though: class Foo @@cls = 0 def initialize @inst = 0 end def increment_instance @inst += 1 end def increment_class @@cls += 1 end def print_stats puts "class var: #{@@cls}, instance var: #{@inst}" end def self.say_hello puts "Hello from a class method!" end end -- Posted via http://www.ruby-forum.com/.