Z
zqssoft
Unregistered / Unconfirmed
GUEST, unregistred user!
下面的代码,执行结果为yes,明显的改变B,也改变了A。但我想让B:=A,但不想在改变B时,让A也跟着改变,有什么办法没有?unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,StdCtrls;type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } A:TButton; public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);var B:TButton;begin A:=TButton.Create(self); A.Parent:=self; A.Top:=10; A.Left:=10; A.Caption:='hello'; B:=A; B.Caption:='yes'; showmessage(A.Caption); B.free;end;