From: Lawrence Maina Date: 2011-02-04T16:35:52+09:00 Subject: problem with inheritance class Input_Agent def intro puts ("A three variable simultaneous equation is of the form:"), ("\n\t\t\tax+by+cz=l"), ("\t\t\tdx+ey+fz=m"), ("\t\t\tgx+hy+iz=n"), ("\nWhere the coeficients, a, b, c, d, e, f, g, h and i can take positive or negative numbers."), ("x, y and z are the variables whose value is to be calculated."), ("l, m and n can also take positive or negative numbers."), ("\nPlease enter the values as prompted:") end def prompt_input print ("a = ") a = gets print ("b = ") b = gets print ("c = ") c = gets print ("d = ") d = gets print ("e = ") e = gets print ("f = ") f = gets print ("g = ") g = gets print ("h = ") h = gets print ("i = ") i = gets end end __________________________________________________________ __________________________________________________________ require 'matrix' require 'mathn' require 'input_agent' class Matrices < Input_Agent left_side=Input_Agent.new() left_side.intro left_side.prompt_input lh=Matrix[[a,b,c],[d,e,f],[g,h,i]] rh=Matrix[[l],[m],[n]] inv=lh.inverse soln=inv*rh soln2=soln.to_a puts ("x = #{soln2[0]}") puts ("y = #{soln2[1]}") puts ("z = #{soln2[2]}") end hello there and thanks in advance. i'm new to ruby and i'm trying to access the values i read in from the first file into the second file through inheritance but i can't get it to work. -- Posted via http://www.ruby-forum.com/.