PDA

View Full Version : Understanding the scope of variables




imPoddible
Nov 24, 2008, 12:17 PM
I hope this question isn't too dumb! I'm just trying to get my head around some Object Oriented programming concepts and there's something I don't quite understand about variables.

I understand about instance variables and how they are limited to the classes/objects they are specified in?

But how do I pass variables between views and methods?

For example, I've written a simple test program which logs and displays the buttons I press in a view. It also displays the total number of button presses.

I then have another button which opens a new 'Statistics" view where I want to show statistics of all buttons pressed and how many times each has been pressed, etc. I want to store all of this info in an Array. Pretty simple stuff - just playing around in order to understand.

But I don't know how to make these statistics available to the new view.

Where do I specify the array so that its available for the initial view and the statistics view?

Thanks for any advice.

imPoddible