How to reference or connect a variable to another class without stack overflow?

Posted by SystemNetworks on Game Development See other posts from Game Development or by SystemNetworks
Published on 2012-10-06T07:50:01Z Indexed on 2012/10/06 9:51 UTC
Read the original article Hit count: 247

Filed under:
|

I really need to re-arrange all my functions. I created a class. All my var, booleans, int, doubles and other things. I created every new variable so they can reference it and so they don't have an error. If your asking why I never just reference my main class vars to my sub-class becuase it will give me stack overflow! When in my main class i link my sub-class.

subClass s = new subClass(); 

Then I reference my fake variable to my real variable for example: This is my sub-class variable(I call it fake)

public int x = 0;

In my main class, I put it like this:

s.x = x;

The problem is, it does not work! Maybe this is not the right place but I cant ask any questions on stack overflow because they banned me. If I connect my main class and connect my sub-class it will give me stack overflow. How do I stop it?

© Game Development or respective owner

Related posts about java

Related posts about slick