New topic: 

Class array methods

<http://forums.realsoftware.com/viewtopic.php?t=32235>

       Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic         Author  
Message       anode           Post subject: Class array methodsPosted: Thu Jan 
28, 2010 6:26 pm                        
Joined: Sat Feb 09, 2008 12:21 pm
Posts: 30              So if I have an array of a class that has methods, do I 
need to address them like:

x = Foo(5).GiveMeAResult

or like a non class array

x = Foo.GiveMeAResult     
_________________
----
Mac OSX 10.6 RB2009r5  Codin' for fun  
                            Top               serd83           Post subject: 
Re: Class array methodsPosted: Thu Jan 28, 2010 6:34 pm                        
Joined: Thu Feb 22, 2007 7:08 pm
Posts: 857              Code:x = Foo(5).GiveMeAResult
Because Foo is an array and the compiler must know which index you will assign 
to the variable x.   
                            Top               mjh           Post subject: Re: 
Class array methodsPosted: Thu Jan 28, 2010 7:16 pm                        
Joined: Sun Feb 19, 2006 3:10 pm
Posts: 596
Location: Hamburg, Germany              anode wrote:So if I have an array of a 
class that has methods, do I need to address them like:

x = Foo(5).GiveMeAResult

or like a non class array

x = Foo.GiveMeAResult
There is nothing special about arrays of objects. For example, if Foo was an 
array of strings then “Foo(5).Len” would return the length of the string at 
index 5. Similarly if Foo was an array of instances of a class with a method 
GiveMeAResult, then “Foo(5).GiveMeAResult” would return the value returned 
by GiveMeAResult as applied to the element at index 5. “Foo.GiveMeAResult” 
wouldn’t compile as there is no such method defined for the array (as opposed 
to its elements).     
_________________
Michael J. Hußmann 
http://digicam-experts.de  
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]     
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to