In the following example B class extends A class, it inherits int a variable.
the cp5 slider is plugged to an instance of a B object, and the assign variable is "a".
import controlP5.*;
ControlP5 cp5;
B b;
void setup()
{
size(200,200);
b = new B();
cp5 = new ControlP5(this);
cp5.addSlider("a")
.setPosition(20,20)
.setRange(0,255)
.plugTo(b,"a");
}
void draw()
{
println(b.a , frameCount);
}
class B extends A
{
B()
{
super();
}
}
class A
{
int a;
A()
{
a = 0;
}
}
the a value printed in console is always 0, so the slider isn't modifying the a variable.
How can I make controlP5 work for the inherited variables of a class?