Smart pascal source code
type
TTest = class
Field: Integer;
property Prop: Integer read Field write Field;
end;
var o: TObject;
o := TTest.Create;
WriteLn((o as TTest).Field);
WriteLn((o as TTest).Prop);
(o as TTest).Field := 1;
WriteLn((o as TTest).Field);
WriteLn((o as TTest).Prop);
(o as TTest).Prop := 2;
WriteLn((o as TTest).Field);
WriteLn((o as TTest).Prop);
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
0
0
1
1
2
2
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}
var TTest = {
$ClassName:"TTest",$Parent:TObject
,$Init:function ($) {
TObject.$Init($);
$.Field = 0;
}
,Destroy:TObject.Destroy
};
var o = null;
/* <<< main JS >>> */
o = TObject.Create($New(TTest));
WriteLn($Check($As(o,TTest),"").Field);
WriteLn($Check($As(o,TTest),"").Field);
$Check($As(o,TTest),"").Field = 1;
WriteLn($Check($As(o,TTest),"").Field);
WriteLn($Check($As(o,TTest),"").Field);
$Check($As(o,TTest),"").Field = 2;
WriteLn($Check($As(o,TTest),"").Field);
WriteLn($Check($As(o,TTest),"").Field);