PDA

View Full Version : Using object Param w/ method for > 1 object


itrickski
11-03-2006, 08:28 PM
i have written a world-level method called "hokey-pokey" in which a student object does this timeless dance. <grin> i wanted to modify this to accept an object parameter, so that i could make different objects do the "hokey pokey". i realize that this method should only be called for objects that have "left legs" and "right legs".

if i create an object param for the method, then the only option i can see is to replace

student1.leftleg turn backwards with
myobjectparam turnl backwards

in other words, i can't get to the "left leg" of the object being passed in as a parameter. Is there a way to accomplish this?

I have the same problem with snowpeople flipping hats in 4.1.1 of "Learning to program with Alice". I thought the idea was to create a method called "fliphat", which could be called for the snowman, or snowwoman. however, i don't know how to make this work.

i hope this question makes sense.

DrJim
11-04-2006, 07:49 PM
I think this is the same question roofy also asked earlier - you might check what I posted there (and maybe someone has come up with a better answer).