record method 3



record_method3
Smart pascal source code
type TRec1 = record F1, F2: Integer; function AsString: String; begin Result := IntToStr(F1) + IntToStr(F2); end; class procedure Here; begin WriteLn('Rec1'); end; end; type TRec2 = record Field: String; function AsString: String; begin Result := Field; end; class procedure Here; begin WriteLn('Rec2'); end; end; var r1: TRec1 := (F1: 12; F2: 34); var r2: TRec2 := (Field: 'Hello'); r1.Here; WriteLn(r1.AsString); r2.Here; WriteLn(r2.AsString); {<<< RESULT - CONSOLE LOG >>> ----------------------------- Rec1 1234 Rec2 Hello ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}