mark rudolph
4/25/2006 6:41:00 AM
I am begining to work with Modules and mixins
and I would really appreciate some insight.
For reference:
module Z
CONST=15
@inst_var=16
def inst_method1
CONST
end
def inst_method2
@inst_var
end
end
class C
include Z
def test
puts "inst_method1 = #{inst_method1}"
puts "inst_method2 = #{inst_method2}"
end
end
o=C.new
puts "#{o.test}" # -> inst_method1 = 15
# -> inst_method2 =
Although both methods appear as methods of o,
only the first returns a value - why?
What is it about @inst_var of Z that will not allow
it to be accessible in o?
Thanks very much.