Parent class



Parent class
Pas2JS pascal source code
type TBase = class end; type TChild = class(TBase); type TSubChild = class(TChild); type TOtherChild = class(TBase); procedure WriteLnHierarchy(base: TClass); begin while Assigned(base) do begin Writeln(' => '); Writeln(base.ClassName); base := base.ClassParent; end; Writeln(''); end; { main.pas } Begin WriteLnHierarchy(TBase); WriteLnHierarchy(TChild); WriteLnHierarchy(TSubChild); WriteLnHierarchy(TOtherChild); { ### CONSOLE OUTPUTS ### => TBase => TObject => TChild => TBase => TObject => TSubChild => TChild => TBase => TObject => TOtherChild => TBase => TObject }