[fpc-devel] Operator overloading question: Impossible to overload assignment for equal types. Why?

Hairy Pixels genericptr at gmail.com
Thu Apr 25 02:58:23 CEST 2024



> On Apr 24, 2024, at 4:59 PM, Bart via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
> 
> In such instances it would really be helpfull if you could just
> overload the assignment operator like:
> operator := (Src: TRec): TRec;
> begin
>  Result := AssignRec(Src);
> end;

I agree this seems reasonable but maybe the Copy operator makes more sense? It should have the same effect I think.

Regards,
Ryan Joseph



More information about the fpc-devel mailing list