Is it necessary to use the 'overload' directive in objfpc mode?

E.g. this code doesn't work:

{$MODE objfpc}
Program Test2;

Type
 TBaseFunClass = Class(TObject)
   Procedure DoStuff(a : Integer; b : Integer); Virtual; Abstract;
   Procedure DoStuff(a : Integer);
 End;
 TFunClass = Class(TBaseFunClass)
   Procedure DoStuff(a, b : Integer); Override;
 End;

Procedure TBaseFunClass.DoStuff(a : Integer);

Begin
 DoStuff(a, 0);
End;

Procedure TFunClass.DoStuff(a, b : Integer);

Begin
 Writeln('TFunClass.DoStuff(', a, ',', b, ')');
End;

Var
 q : TFunClass;

Begin
 q := TFunClass.Create;
 q.DoStuff(5);
 q.Destroy;
End.

fpc 1.1 says:
...
test2.pas(30,14) Error: Wrong number of parameters specified
test2.pas(10,15) Hint: Found declaration: TFunClass.DoStuff(Longint,Longint)
test2.pas(33) Fatal: There were 1 errors compiling module, stopping

fpc 1.0.6 gives the same error, only without the hint :-)

When I put 'overload;' everywhere it works. Is it necessary to use 'overload;' everywhere in objfpc mode or it's just a 'feature' of the compiler. And what's the reason why Borland introduced the 'overload' directive for function overloading?

_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to