a noobish question on variable scope
what is the easiest way to access variables defined in another class
for example
Code:
public partial class Form1 : Form
{
public int x ;
public int y ;
public [,]int array = new int[10,10];
// more functions etc
}
now in a new class
Code:
public class myclass()
{
public void addup()
{
x = 50;
y = 100;
array[0,1] = x+y;
}
this is very simplified and i can do what i want by passing them to the function but in some cases i need to alter a lot of variables which were not created in this class. Passing them all over will not be helpful or easy to follow. i have tried a few ways but being new to OOP i was wondering if i am missing something here?
once again thanks in advance