From: Gary Wright Date: 2007-03-19T07:57:26+09:00 Subject: Re: beginning question. modules + object creation On Mar 18, 2007, at 6:38 PM, Corey Konrad wrote: > I was wondering if i create a modules file called mathematics.rb: > > module Mathematics > class Add > def add(operand_one, operand_two) > return operand_one + operand_two > end > > end#end class > end > > and then i create another file called usemodules.rb > > require 'mathematics' > > > adder = Add.new > puts "2 + 3 = " + adder.add(2, 3).to_s Because you nested your class Add within Mathematics you have to use the fully qualified name when you are writing code that is outside the Mathematics module: adder = Mathematics::Add.new puts "2 + 3 = #{adder.add(2,3)}" Gary Wright