?? fmidservicemain.pas
字號:
unit fmIDServiceMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
mmInfos: TMemo;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure AppMsg(const sMsg : String);
end;
TForm3 = class(TForm2)
end;
var
Form2: TForm2;
implementation
uses uClasses;
{$R *.dfm}
procedure TForm2.AppMsg(const sMsg: String);
begin
mmInfos.Lines.Add(sMsg);
end;
procedure TForm2.Button1Click(Sender: TObject);
var
aBase : TBase;
adr1 : TDerived1;
adr2 : TDerived2;
begin
aBase := TBase.Create;
adr1 := TDerived1.Create;
adr2 := TDerived2.Create;
try
AppMsg('InstanceSize :' + IntToStr(aBase.InstanceSize));
AppMsg('InstanceSize :' + IntToStr(adr1.InstanceSize));
AppMsg('InstanceSize :' + IntToStr(adr2.InstanceSize));
finally
FreeAndNil(adr2);
FreeAndNil(adr1);
FreeAndNil(aBase);
end;
end;
procedure TForm2.Button2Click(Sender: TObject);
var
aBase : TBase;
adr2 : TDerived2;
begin
aBase := TBase.Create;
adr2 := TDerived2.Create;
try
if (adr2.InheritsFrom(TBase)) then
AppMsg('TDerived2 is inherited from TBase')
else
AppMsg('TDerived2 is not inherited from TBase')
finally
FreeAndNil(adr2);
FreeAndNil(aBase);
end;
end;
procedure TForm2.Button3Click(Sender: TObject);
var
ac : TClass;
f3 : TForm3;
begin
f3 := TForm3.Create(Self);
try
ac := f3.ClassParent;
if (ac = TForm2) then
AppMsg('TForm2 is the parent class of TForm3')
else
AppMsg('TForm2 is not the parent class of TForm3')
finally
FreeAndNil(f3);
end;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -