View Single Post
Call custom method from objects in list
Old
dragnet
Member
 
Status: Offline
Posts: 38
Join Date: Jan 2010
Default Call custom method from objects in list - 03-18-2010, 01:02 PM

I've looked though examples and also through the text books. Can't seem to find a way to call custom methods whe iterating through an object list. For example I want to call a swim method for each fish in a list I've created 'allFish'. When I create a 'For all together' loop to iterate through my array 'allFish', the only options that show up are method calls to the built in object methods, no custom methods are listed. Is there a way to change this?

My only other option is to create a world method that accepts an object and makes it move as I want. Then I can cycle through my list and pass each object to the world method. It works but is not what I would consider as clean of a coding technique.

Thanks.
   
Reply With Quote