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.

And one more question: Does `Default(TComposedRecord)` correctly intialize the 
complete structure?

Basically it does a fillchar(var,sizeOf(TComposedRecord),0), so that should be
sufficient.

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

Reply via email to