How do I get a variable from the class that created the class ?
One a;
void setup() {
a=new One();
}
void draw() {}
public class One {
Two b;
int num;
One() {
num=9;
println(num);
b=new Two();
}
}
class Two {
Two() {
println(a.num); // error How do I get the num variable ?
}
}
//One a;
Two b;
void setup() {
// a=new One();
b=new Two();
}
void draw() {}
public class One {
// Two b;
int num;
One() {
num=9;
println("from One: "+num);
// b=new Two();
}
}
class Two extends One{
Two() {
println("from Two b "+num);
}
}
// not even need super(..)