Class scoping



Class scoping
Smart pascal source code
type TTest1 = class protected Field: Integer; end; type TTest2 = class private procedure Internal; begin WriteLn('Internal was called'); end; end; type TTest3 = class Field1: TTest1; Field2: TTest2; procedure Here; end; procedure TTest3.Here; begin Writeln(IntToStr(Field1.Field)); Field2.Internal; end; { main.pas } var c : TTest3; Begin c := TTest3.Create; c.Here; { ### CONSOLE OUTPUTS ### Uncaught TypeError: Cannot read property 'Field' of null }