Brief discussion for problem - what does the following


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

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Brief discussion for problem - what does the following
Reference No:- TGS0663595

Expected delivery within 24 Hours