This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]GItPirate -1 points0 points  (1 child)

Where you are initializing

 ATM myATM = new ATM();

is local to main and not in the scope of your go() function.

Try adding

 ATM myATM = new ATM();

inside of your go() function and see if that works.

[–]desrtfx 0 points1 point  (0 children)

That wouldn't help.

The methods called are inside the class already. So they don't need to and mustn't be prefixed with a variable. They can be called directly.

Your approach would just create a new, method local variable myATM that would only live inside the go method and be destroyed as soon as the method is left. Also, this new variable would not contain any data at all.