Pascal samples. Script-defined class types.


uses
  Classes;
type
  TMyComponent = class(TComponent)
    procedure Show; virtual; abstract;
  end;

  TMyClass = class(TMyComponent)
    procedure Show; override;
  end;

procedure TMyClass.Show;
begin
  writeln('TMyClass');
end;

var
  X: TMyComponent;
begin
  X := TMyClass.Create(nil);
  X.Name := 'abc';
  writeln(X.Name);
  X.Show;
  X.Free;
end.


Copyright © 2006-2017 Alexander Baranovsky. All rights reserved.