unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Unit2;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
Procedure ShowName(Intf:IFormattedNumber);
Procedure ShowNameConst(const Intf:IFormattedNumber);
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
unit Unit2;interface
uses
Classes,SysUtils,Dialogs;
type
IFormattedNumber = interface
['{2985B72E-B441-4D9F-99B0-DAED049CB1D2}']
function FormattedString: string;
function Getname: string;
end; TFormattedInteger = class(TInterfacedObject, IFormattedNumber)
private
FValue : Integer;
Public
constructor Create(AValue:Integer);
destructor Destroy; override;
function FormattedString: string;
function GetName: string;
end;
TFormattedHexInteger = class(TFormattedInteger, IFormattedNumber)
public
destructor Destroy; override;
function FormattedString: string;
function GetName: string;
end;implementationuses
Unit1;constructor TFormattedInteger.Create(AValue: Integer);
begin
inherited Create;
FValue := AValue;
end;
destructor TFormattedInteger.Destroy;
begin
Form1
为什么我在unit2中用from1的Memo1用不上可能什么原因谢谢!
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Unit2;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
Procedure ShowName(Intf:IFormattedNumber);
Procedure ShowNameConst(const Intf:IFormattedNumber);
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
unit Unit2;interface
uses
Classes,SysUtils,Dialogs;
type
IFormattedNumber = interface
['{2985B72E-B441-4D9F-99B0-DAED049CB1D2}']
function FormattedString: string;
function Getname: string;
end; TFormattedInteger = class(TInterfacedObject, IFormattedNumber)
private
FValue : Integer;
Public
constructor Create(AValue:Integer);
destructor Destroy; override;
function FormattedString: string;
function GetName: string;
end;
TFormattedHexInteger = class(TFormattedInteger, IFormattedNumber)
public
destructor Destroy; override;
function FormattedString: string;
function GetName: string;
end;implementationuses
Unit1;constructor TFormattedInteger.Create(AValue: Integer);
begin
inherited Create;
FValue := AValue;
end;
destructor TFormattedInteger.Destroy;
begin
Form1
为什么我在unit2中用from1的Memo1用不上可能什么原因谢谢!
先ctrl + shift + c 把函數實現框架搭起來,怎麽可能用不了?