Field scope | class scope



Field scope | class scope
Smart pascal source code
type TBase = class Field: Integer; procedure WriteLnBase; end; type TChild = class(TBase) Field: Integer; procedure WriteLnChild; end; procedure TBase.WriteLnBase; begin WriteLn(Field); end; procedure TChild.WriteLnChild; begin WriteLn(Field); end; {------- main.pas -------} Begin var c := TChild.Create; var b: TBase := c; b.Field := 1; c.Field := 2; b.WriteLnBase; c.WriteLnBase; c.WriteLnChild; { <<< CONSOLE OUTPUTS >>> 1 1 2 }