function GetStringList: TStringList;
begin
result := TStringList.Create;
result.Add('an item') ;
end;
...
var
sl : TStringList;
begin
sl := GetStringList;
try
ShowMessage(sl[0]) ;
// or something like
// ListBox1.Items.Assign(sl) ;
finally
sl.Free;
end;
end;함수에서 객체를 Create하고 결과를 리턴받는 부분에서 함수에서 생성한 객체를 Free 시켜준다. 라는게 포인트..
흐음..... 결과적으로 Create한 객체를 함수로 넘겨주는거나 별반 다를게 없는 방법인데..... -_-?




