Hello
I have a protected variable in a class (Class A) that I need to call from
another class (Class B) to modify. I thought what I had to do was create a
public method in the class (Class A) containing the protected variable so
that the modification(s) can be done.
However, when I try this, I cannot see the public method from the second
class (Class B) unless it is declared static. If the method is static, then
using this.variable.attribute does not work.
Any suggestsions? I can change it from protected to private if need be.
Thanks for any and all help.
Ben
Sample of what i need done
Public Class A
{
protected int a;
public void main() {}
//method here to access and change the properties of a from outside
class(es)
public static void change(int b) {this.a = b;}
}
Public Class b
{
public void main()
{
namespace.A.change(5);
}
}