Accessing private class variables
Posted on 2003-12-01
Im having trouble finding a solution for the following problem:
I have a class A that contains a private variable:
private double variable;
I need to access variable (both get and set) from another class, WITHOUT adding get and set methods to the class. I tried to use a second, inner, class as it too whould have access to the variable, however this was daft as you cannot instante inner classes of one class from another...
I need a way to access variable, whether it be through a second class or some kind of hack.
Thanks in advance for your assistance.