fmmain.pas

来自「多数代码可以直接在Delphi6和Delphi7环境下运行。部分涉及.NET技术」· PAS 代码 · 共 67 行

PAS
67
字号
unit fmMain;

interface

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

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

var
  Form1: TForm1;

implementation

uses uClasses;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  aObj : TBase;
begin
  aObj := TDerived1.Create;
  aObj.VM2;
  aObj.Free;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  aFoo : TFoo;
  aFoo1 : TFoo;
begin
  aFoo := TFoo.Create;
  aFoo1 := TFoo.Create;
  try
{
    aFoo.Field := 10;
    aFoo.SetField(10);
    aFoo.SetStr('Test');
    ShowMessage(IntToStr(aFoo.Field));
    ShowMessage(aFoo.GetStr);
    aFoo.VM1;
}
    aFoo.VM1;
    aFoo1.VM1;

    ShowMessage(aFoo.MyName);
    ShowMessage(aFoo1.MyName);
  finally
    aFoo.Free;
    aFoo1.Free;
  end;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?