|
Author |
Topic: Variable of a class (Read 283 times) |
|
eskimoblood
|
Variable of a class
« on: Jan 19th, 2005, 4:18pm » |
|
I have a class with a stringArray. I thought I can get the value of this array, outside the class, like className.arrayName[i] but it dosent work.
|
|
|
|
mKoser
|
Re: Variable of a class
« Reply #1 on: Jan 19th, 2005, 4:57pm » |
|
you can access it like this: Code: MyClass myObj; void setup(){ myObj = new MyClass(); } void loop(){ } void mousePressed(){ println(myObj.strArr[(int)random(0, 3)]); } class MyClass{ String[] strArr = {"the", "brown", "fox", "jumps"}; MyClass(){ } } |
| where every time you click, a random string is printed from the myObj's stringArray! does that help? + mikkel
|
mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
|
|
|
|