On 10/22/2026 8:24 PM, Michael Van Canneyt via fpc-pascal wrote:
On Thu, 22 Oct 2026, Thomas Kurz via fpc-pascal wrote:

I'm trying to use this feature, but I'm having some trouble:

All of my records contain a parameterless `class function Create: TWhateverRecord; static;`.

Now, when I try to contain one within the other, I'm stumbling across this compiler error:

Error: Overloaded identifier "CREATE" isn't a function

I guess this is because both records now have a `Create` function with the same signature. But how can I resolve that conflict?

You cannot, it is a shortcoming of composed records. There is no way to
distinguish between the various methods. Although the message needs
improvement.

I guess you can help yourself with a record helper:

TWhateverRecordHelper = record helper for TWhateverRecord
public
  class function Create: TWhateverRecord; static;
end;

Ondrej

_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to