D
dlwzp
Unregistered / Unconfirmed
GUEST, unregistred user!
代码如下:
总是出现不能复制对象的异常
type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
ta = class(TPersistent)
public
i: integer;
end;
type
tb = class(TPersistent)
public
i: integer;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
var
aaa: ta;
bbb: ta;
begin
aaa := ta.Create(Self);
bbb := ta.Create(Self);
if (aaa = nil) or (bbb = nil) then
exit;
try
bbb.Assign(aaa);
finally
aaa.Free;
bbb.Free;
end;
总是出现不能复制对象的异常
type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
ta = class(TPersistent)
public
i: integer;
end;
type
tb = class(TPersistent)
public
i: integer;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
var
aaa: ta;
bbb: ta;
begin
aaa := ta.Create(Self);
bbb := ta.Create(Self);
if (aaa = nil) or (bbb = nil) then
exit;
try
bbb.Assign(aaa);
finally
aaa.Free;
bbb.Free;
end;