record obj field



record_obj_field
Smart pascal source code
Type TMyRecord = Record mrId: Integer; mrObj: TObject; End; var mRec: TMyRecord; if not Assigned(mRec.mrObj) then WriteLn('not assigned'); if Assigned(mRec.mrObj) then WriteLn('assigned'); WriteLn(mRec.mrId); mRec.mrObj := TObject.Create; mRec.mrId := 12; WriteLn(mRec.mrObj.ClassName); WriteLn(mRec.mrId); mRec.mrObj := NIL; mRec.mrId := 0; if mRec.mrObj <> nil then WriteLn('assigned'); if mRec.mrObj = nil then WriteLn('not assigned'); WriteLn(mRec.mrId); {<<< RESULT - CONSOLE LOG >>> ----------------------------- not assigned 0 TObject 12 not assigned 0 ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}