Hi:
I have a question about some code in the pickaxe book on page 103:
module Notes
attr :concertA
def tuning(amt)
@concertA = 440.0 + amt
end
end
class Trumpet
include Notes
def initialize(tune)
tuning(tune)
puts "Instance method returns #{concertA}"
puts "Instance variable is #{@concertA}"
end
end
Trumpet.new(-5.3)
Returns:
Instance method returns 434.7
Instance variable is 434.7
I don't understand where the instance method 'concertA' is defined. I see
that the instance variable '@concertA' is defined.
Can someone please explain this to me.
Thanks
====================================================
Jim Freeze
jim / freeze.org
---------------------------------------------------
** http://www.freeze.org **
====================================================