https://processing.org/reference/private.html:
This keyword is used to disallow other classes access to the fields and methods within a class. The private keyword is used before a field or method that you want to be available only within the class. …
I tried, but still got access to a private method:
// “main file” ProcessingPrivateTest.pde
void setup () {
cMyClass myObject = new cMyClass ();
println (myObject.getX ());
println (myObject.getY ()); // WHY IS THIS ALLOWED?
} // < setup
void draw () {
} // < draw
// file cMyClass.pde in same directory (-> tab above)
class cMyClass {
int x, y;
cMyClass () {
x = 8; y = 12;
} // < cMyClass::cMyClass
int getX () {
return x;
} // < cMyClass::getX
private int getY () {
return y;
} // < cMyClass::getY
} // < class cMyClass