Problem 2
Brief discussion for Problem
Here is a class definition in Ruby:
class C
attr_accessor :f
def g(x)
self.f=(x)
end
def h(x)
f = x
end
def i(x)
self.f = x
end
end
What does the following transcript teach us?
>> c = C.new
=> #
>> c.g(2)
=> 2
>> c.f
=> 2
>> c.h(5)
=> 5
>> c.f
=> 2
>> c.i(7)
=> 7
>> c.f
=> 7