[fpc-pascal] same routine with different parameters?

waldo kitty wkitty42 at windstream.net
Wed Oct 30 23:41:55 CET 2013


On 10/30/2013 5:18 AM, Sven Barth wrote:
> Am 29.10.2013 20:32, schrieb waldo kitty:
>> On 10/29/2013 1:56 PM, Sven Barth wrote:
>>> Am 29.10.2013 18:21 schrieb "waldo kitty" <wkitty42 at windstream.net>:
>>>  > example:  procedure MyObject.MyRoutine;
>>>  >           procedure MyObject.MyRoutine(VarA : SomeType);
>>>  >           procedure MyObject.MyRoutine(VarA : string; VarB: integer);
[...]
>>> Note: In mode Delphi and a few other cases (e.g. cross unit overloads,
>>> inheritance) you'll need to add the "overload" directive.
>>
>> ahhh... i believe that the library i'm using does use mode delphi all over the
>> place... do i add "overload;" to each of the 'duplicate' routines?
> Yes.

yes, i did have to add "overload;" to both declarations... so far, tests show 
that this is working as desired... the original with no parameters is called and 
it calls itself with no parameters like it always has and my version calls 
itself with parameters as desired... it looks good...

i just wish that i had been able to do the inheritance thing so that i didn't 
have to modify the original object to add another variable and my custom 
routine... i guess i should try that again and see why... IIRC, it had to do 
with an object that is assigned as an internal routine not being registered or 
such... the compiler message i recall was about registration...

>>> For additional information please look at the language reference guide (can't
>>> look up the link currently).
>>
>> i don't even know what to search for... although 'overload' may give me a
>> start...
>>
> It seems that overloading is only mentioned here:
> http://www.freepascal.org/docs-html/ref/refse79.html#x163-17300014.5

yeah, i found that and i think one other but wasn't too sure i was on a proper 
track at that time...


-- 
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