unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  TA = class(TObject)
  private

  protected

  public
    procedure a; virtual; abstract;
    destructor Destroy; override;
  published

  end;

  TB = class(TA)
  private

  protected

  public
    procedure a; reintroduce;
    destructor Destroy; override;
  published

  end;

  TC = class(TB)
  private

  protected

  public
    procedure a; reintroduce;
    destructor Destroy; override;
  published

  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var a : TC;
begin
  a := tc.Create;
  a.Free;

end;

{ TC }

procedure TC.a;
begin
  Form1.caption := Form1.caption + 'c';

end;

destructor TC.Destroy;
begin
  a;
  inherited;

end;

{ TB }

procedure TB.a;
begin
  Form1.caption := Form1.caption + 'b';

end;

destructor TB.Destroy;
begin
  a;
  inherited;

end;

{ TA }

destructor TA.Destroy;
begin
  inherited;

end;

end.

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 末三 的頭像
    末三

    五顆星星的故事

    末三 發表在 痞客邦 留言(0) 人氣()