Smart pascal source code
type
TStatic = class
class procedure WriteLn; static;
begin
Default.WriteLn('Hello ');
Default.WriteLn(ClassName);
end;
end;
type
TSubStatic = class(TStatic);
TStatic.WriteLn;
var c := TStatic;
c.WriteLn;
var o := TStatic.Create;
o.WriteLn;
TSubStatic.WriteLn;
var cs := TSubStatic;
cs.WriteLn;
var os := TSubStatic.Create;
os.WriteLn;
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
Hello TStatic
Hello TStatic
Hello TStatic
Hello TStatic
Hello TStatic
Hello TStatic
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}
var c = null,
o = null,
cs = null,
os = null;
/// TStatic = class (TObject)
/// [line: 39, column: 3, file: uMain]
var TStatic = {
$ClassName:"TStatic",$Parent:TObject
,$Init:function ($) {
TObject.$Init($);
}
/// procedure TStatic.WriteLine()
/// [line: 40, column: 21, file: uMain]
,WriteLine:function() {
WriteLn("Hello ");
WriteLn(TObject.ClassName(TStatic));
}
,Destroy:TObject.Destroy
};
/// TSubStatic = class (TStatic)
/// [line: 48, column: 3, file: uMain]
var TSubStatic = {
$ClassName:"TSubStatic",$Parent:TStatic
,$Init:function ($) {
TStatic.$Init($);
}
,Destroy:TObject.Destroy
};
TStatic.WriteLine();
c = TStatic;
TStatic.WriteLine();
o = TObject.Create($New(TStatic));
TStatic.WriteLine();
TStatic.WriteLine();
cs = TSubStatic;
TStatic.WriteLine();
os = TObject.Create($New(TSubStatic));
TStatic.WriteLine();