[Lazarus] Class const of array of record.

Hans-Peter Diettrich DrDiettrich1 at aol.com
Fri Feb 24 14:35:43 CET 2012


Everton Vieira schrieb:
> I was trying to make this construction:
>  
> type
>   TRec = record
>     Numero: Integer;
>     Nome: String;
>   end;
>  
> function mTRec(Numero: Integer; Nome: String): TRec;
>  
> type
>   TTest = class
>     const Nomes: array[0..2] of TRec = (mTRec(1, 'everton'), mTRec(2, 
> 'murilo'), mTRec(3, 'vieira'));
>   end;
[...]


> Is there any how to do it?

Do what?

Above declaration looks to me as if you define a constant array, that 
exists only once in memory. You can move the "const..." out of the 
class, with the same effect.

DoDi





More information about the Lazarus mailing list