7stud – wrote in post #1147486:
The defs you created inside your class cannot be called on the class
itself. You have to create on object of the class and call the methods
on the object:
my_input = Input1.new(10, 20)
You should also be aware that the variables @n1 and @n2 that you used
outside the class are different variables than the ones inside the
Also, the way you have written your class, there is no way for you to
or set the variables @n1 and @n2 for the object you created once those
values have been initialized.
Thanks for the response. After trying quite a bit, I’m still at a loss.
What I originally did was to write a script version of this class (that
worked pretty well) and turn it into an O-O version (i.e., a class),
which doesn’t work. It does work with other similar exercises that don’t
use keyboard input, but as soon as keyboard input is involved, it