I would post my program (roulette), but it's created in my language, and there would be alot. So this is exactly as the classes in my program work. I didn't know how to google this issue correctly.
Class Class1{
int variable1=0;
}
Class Class2{
Class1 variableC1;
Class1 variableC2;
}
void main(){
Class2 someClass2 = new Class2();
Class1 someClass1 = new Class1();
someClass2.variableC1=someClass1;
someClass2.variableC2=someClass1;//that's the way I have to set them in my program, or else it doesn't work
someClass2.variableC1.variable1=1001; //now this will set both the variableC1 and variableC2 to 1001, even tho i want variableC2.variable1 to stay at 0
}
So as I said in the comments, when i set one class' variable, both change even tho i only want the one to.
I know this looks like horible programing, I think the same, but that's the only way it worked for me (and the only way i know how to, new to objects). Any suggestions would be great.