Smart pascal source code
type
TStatic = class
class procedure WriteLine; static;
begin
WriteLn('Hello ');
WriteLn(ClassName);
end;
end;
type
TSubStatic = class(TStatic);
var c := TStatic;
var o := TStatic.Create;
var cs := TSubStatic;
var os := TSubStatic.Create;
var p: Procedure;
p := TStatic.WriteLine;
p;
p := TSubStatic.WriteLine;
p;
p := c.WriteLine;
p;
p := cs.WriteLine;
p;
p := o.WriteLine;
p;
p := os.WriteLine;
p;
{<<< 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,
p = 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
};
c = TStatic;
o = TObject.Create($New(TStatic));
cs = TSubStatic;
os = TObject.Create($New(TSubStatic));
p = TStatic.WriteLine;
p();
p = TStatic.WriteLine;
p();
p = TStatic.WriteLine;
p();
p = TStatic.WriteLine;
p();
p = TStatic.WriteLine;
p();
p = TStatic.WriteLine;
p();