G
Guest
I'm sure once someone answers this I'll feel really dumb.
I'm a c++ programmer playing with c# an here's my conundrum
I declare a class in the for
public class Form1 : System.Windows.Forms.For
class Class
public int
ge
return x
se
x = value
}
..
I declare an array of the class in the body of the form as a member of the form
ClassA [] ClassAArray = new ClassA[10]
In the Consructor of the form I init the array (this is probably what I'm messing up
public Form1(
InitializeComponent()
for(int i = 0 ; i < 10 ; i++
ClassAArray= new ClassA()
When I try to access the member "i" it's not initialized, and i get a stack overflow exception
private void button1_Click(object sender, System.EventArgs e
ClassAArray[0].x = 0
Orinigally did this with a string member, but the same thing happens with and int member
Can anyone tell me what I'm missing about creating an instance of an array of a class
Thanks
Eric
I'm a c++ programmer playing with c# an here's my conundrum
I declare a class in the for
public class Form1 : System.Windows.Forms.For
class Class
public int
ge
return x
se
x = value
}
..
I declare an array of the class in the body of the form as a member of the form
ClassA [] ClassAArray = new ClassA[10]
In the Consructor of the form I init the array (this is probably what I'm messing up
public Form1(
InitializeComponent()
for(int i = 0 ; i < 10 ; i++
ClassAArray= new ClassA()
When I try to access the member "i" it's not initialized, and i get a stack overflow exception
private void button1_Click(object sender, System.EventArgs e
ClassAArray[0].x = 0
Orinigally did this with a string member, but the same thing happens with and int member
Can anyone tell me what I'm missing about creating an instance of an array of a class
Thanks
Eric