Smart pascal source code
unit partial_class_unit;
interface
type
TTest = partial class Field: Integer;
procedure WriteLnMe;
end;
TTest = partial class procedure Inc;
end;
implementation
type
TTest = class
partial procedure Dec;
begin
Field -= 1;
end;
end;
TTest = partial class procedure WriteLnDoubled;
begin
WriteLn(Field * 2);
end;
end;
procedure TTest.WriteLnMe;
begin
WriteLn(Field);
end;
procedure TTest.Inc;
begin
Field += 1;
end;
initialization
var o := new TTest;
o.WriteLnMe;
o.Inc;
o.WriteLnMe;
o.WriteLnDoubled;
o.Dec;
o.WriteLnMe;
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
0
1
2
0
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}