On 10/06/10 15:38, Charlie Reinl wrote:
> Am Donnerstag, den 10.06.2010, 14:37 +0800 schrieb Werner:
>   
>> I'm trying to implement a simple class that creates a Float[3] array. I
>> would like to give the user of the class an optional opportunity to fill
>> the array with data when the class is instantiated.
>>
>> ----------------------------------------
>> ' Gambas class file
>> ' Vector3f Class
>>
>> Public v As New Float[3]
>>
>> Public Sub _new(Optional x As Float, y As Float, z As Float)
>>   If Param.Count > 0 Then v[0] = x
>>   If Param.Count > 1 Then v[1] = y
>>   If Param.Count > 2 Then v[2] = z
>> End
>> ---------------------------------------
>>
>> The above does not work because Param.Count is always 0 no matter if
>> parameter values are supplied or not. My guess is that's because
>> Optional can only be used from the second parameter onwards (why?).
>>
>> How can I make this class do what it should?
>>
>> Thanks
>> Werner Dahn
>>     
> Salut Werner,
>
> where Param is filled? , what is Param ? an array? the class ?
>
> for Optional, I do not know if it can be chained like you do.
> But it can be used also on the first Parameter.
>   
Param is a Gambas Class. It can be used to find out how many parameters
are supplied to a routine. It's just the way my example is written it
always gives a Count of zero, no matter how many parameters are actually
supplied.
http://gambasdoc.org/help/comp/gb/param


Regards
Werner


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to