[fpc-pascal] same routine with different parameters?

waldo kitty wkitty42 at windstream.net
Wed Oct 30 02:06:02 CET 2013


On 10/29/2013 6:53 PM, Mark Morgan Lloyd wrote:
> waldo kitty wrote:
>
>>> Another
>>> useful variant is giving *the* *last* parameter an optional value, which will
>>> allow you to omit the parameter:
>>>
>>> procedure MyObject.MyRoutine(const VarA : string; VarB: integer= -1);
>>
>> very interesting... will this work with both parameters, too? i don't think i
>> need it in this specific situation, though... i'm mainly wanting to provide
>> the original unmodified routine and my modification of it so i can return
>> something to that 3rd party library development...
>
> Yes, provided that you don't also try to have a procedure with no parameters. In
> general, the compiler will tell you if you're doing something silly.

hummm... it wouldn't be the first time that i've not groked what the error 
messages were trying to tell me... that's why i decided to try this vector 
instead of the failed attempts to create another opbject based on the original 
and inherit the procedures with a replacement of this particular one...

> Assume that this is for value parameters only. In particular, I don't think
> there's a way of defaulting a var parameter to a nil pointer.

hummm... the original has no parameters at all... my addition has two... will 
this be a problem? no, i've not had a chance to get back to the development 
machine and try :?

-- 
NOTE: No off-list assistance is given without prior approval.
       Please keep mailing list traffic on the list unless
       private contact is specifically requested and granted.



More information about the fpc-pascal mailing list