I came across something unexpected today, and wondered if anyone could
explain it to me. If I have this class:
@bar = 0
bar += 1
then the “add” function doesn’t work - it complains about a nil
object. You have to specifically put “self.bar += 1”. Why is that - I
thought that the “self” was implicitly there?
f = Foo.new
works as the class stands, so you only seem to need the self if you
are calling the accessor from within your class.