[fpc-devel]Method overloading

Peter Vreman peter at freepascal.org
Tue Apr 29 14:28:02 CEST 2003


> Hi!
>
>> Please try it with 1.1 compiler. Also for inherited overloading you need
>> to specify the overload keyword explicitly.

The overload keyword was introduced in Delphi 5. We supported it already
for delphi compatibility. Since Delphi also does inherited overloading we
choose the best way to be both backwards compatible and delphi compatible.
When the overload keyword is not used then overloading works only in the
current scope. With the overload keyword the overloading will enable
global/inherited overloading.

With overload you can also overload cross units:

unit a;
procedure test(s:string);

unit b;
procedure test(i:longint);overload;

program c;
uses b;
begin
  test('string');
end.






More information about the fpc-devel mailing list