[fpc-pascal] passing a class parameter as a const

Michael Van Canneyt michael.vancanneyt at wisa.be
Fri Jan 12 14:37:44 CET 2007



On Fri, 12 Jan 2007, Graeme Geldenhuys wrote:

> Hi
> 
> Does passing a class parameter as a const make any difference?
> 
> eg:
> 
>  Add(const AObject: TtiObject);
> 
>      vs
> 
>  Add(AObject: TtiObject);
> 
> 
> >From what I can see it shouldn't.  Most Delphi code and Free Pascal
> FCL code doesn't use 'const' for class parameters.

It makes no difference, except that you cannot do

AObject:=SomeOtherObject;

in the first case.

Michael.



More information about the fpc-pascal mailing list