[fpc-pascal] same routine with different parameters?
Sven Barth
pascaldragon at googlemail.com
Wed Oct 30 10:18:16 CET 2013
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);
>> >
>> > at one point, the first instance would be used... at another point
>> one of the
>> > other instances would be used with the only difference being the
>> parameters that
>> > are passed or not... i know that i would have individual instances
>> with the
>> > necessary header and code for each... i just don't know if there
>> is anything
>> > else special that needs to be done or if it can be done with an
>> internal class
>> > object routine..
>>
>> The most important point to keep in mind us that the parameters need
>> to be
>> different (the result type does not count though!).
>
> in this specific case, it will be one without any parameters (the
> original in the 3rd party library) and one with parameters (my needed
> modifications)...
That's valid :)
>
>> 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.
>
>> 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
Regards,
Sven
More information about the fpc-pascal
mailing list