Z
zlj555
Unregistered / Unconfirmed
GUEST, unregistred user!
我用RECORD和CLASS存放两组数据,我通过在一个过程里用
PointerArr : TList;
procedure TForm1.addRec;
var
midRec : pMyRec;
begin
new(midRec);
midRec^.name := 'zlj';
midRec^.caption :='caption';
if PointerArr.Count <> 0 then
midRec.caption :=midRec.caption+IntToStr(PointerArr.count);
PointerArr.Add(midrec);
end;
按上我可以保存一组记录.
但是我把Record改成了class则不可以,也许我代码有问题,大家帮忙看一下.
以下不能保存任何数据.
var
midclass : TMyClass;
pmidClass MyClass;
begin
new(pmidClass);
pmidClass := TMyClass.Create;
pmidClass^.name :='zlj';
pmidClass^.caption := 'caption'+IntToStr(PointerArr.count);
pointerArr.Add(pmidClass);
PointerArr : TList;
procedure TForm1.addRec;
var
midRec : pMyRec;
begin
new(midRec);
midRec^.name := 'zlj';
midRec^.caption :='caption';
if PointerArr.Count <> 0 then
midRec.caption :=midRec.caption+IntToStr(PointerArr.count);
PointerArr.Add(midrec);
end;
按上我可以保存一组记录.
但是我把Record改成了class则不可以,也许我代码有问题,大家帮忙看一下.
以下不能保存任何数据.
var
midclass : TMyClass;
pmidClass MyClass;
begin
new(pmidClass);
pmidClass := TMyClass.Create;
pmidClass^.name :='zlj';
pmidClass^.caption := 'caption'+IntToStr(PointerArr.count);
pointerArr.Add(pmidClass);