我将传入的StringList赋给类的私有成员。
如:
procedure TRight.SetOperatorPower(poPowerList:TStringList);
begin
FoPowerList := poPowerList;
end;FoPowerList 为类TRight的私有成员
如:
procedure TRight.SetOperatorPower(poPowerList:TStringList);
begin
FoPowerList := poPowerList;
end;FoPowerList 为类TRight的私有成员
FoPowerList := poPowerList;
begin
if not Assigned(FoPowerList) then
FoPowerList := TStringList.Create;
FoPowerList.Assign(poPowerList);
end;
FoPowerList := poPowerList;
这样就行
a,b:TStrings;
begin
try
a:=TStringList.Create;
b:=TStringList.Create;
a.Add('Hello');
b.Assign(a);
finally
a.Free;
b.Free;
end;
end;
begin
if not Assigned(FoPowerList) then
FoPowerList := TStringList.Create;
FoPowerList.Assign(poPowerList);
end;