PDA

View Full Version : Accessing user defined methods from arrays.


h4l0
05-29-2009, 01:59 AM
Alice will let you do the following:

for (int index=0; index< 3 times ; index++) {
( whichObject [ index ] ) .move( RIGHT , 5 meters );
}

Where whichObject is an array that contains three objects.

However it won't let me do this:

for (int index=0; index< 3 times ; index++) {
( whichUfo [ index ] ) .userDefinedMethod();
}

Other than using if statements, is there a way around this?

Thanks

h4l0

mlandis
08-03-2009, 09:15 AM
I am curious to see an answer to this question as well. Does anyone have any ideas?

Veryuhbull
08-03-2009, 10:55 AM
this is a way for users to access array's and do a method. Hope this gives you an idea.