Class initialization



Class initialization
Smart pascal source code
type TBase = class F := 123; A := [1, 2, 3]; procedure P; virtual; begin Writeln(F); Writeln(A.Length); Writeln(A[0]); Writeln(A[1]); Writeln(A[2]); end; end; type TChild = class(TBase) B = 4.5; procedure P; override; begin inherited P; Writeln(B); end; end; { unit1.pas } var b := TBase.Create; c := TChild.Create; Begin b.P; c.P; { ### CONSOLE OUTPUTS ### 123 3 1 2 3 123 3 1 2 3 4.5 }