我在有些delphi经典示例中经常看到一个现象,我无法完全理解,所以想请教请教大家.
程序中声明了一个TServerSocket(stThreadBlocking)实例,当触发GetThread事件后在ClientExecute中同步执行在窗体的ListView中添加该线程.主要代码如下:
procedure TfrmMain.AddClient(Thread: TServerClientThread);
var
  Item: TListItem;
begin
  Item := ConnList.Items.Add;
  Item.Caption := IntToStr(Thread.ClientSocket.LocalPort);
  Item.SubItems.Add(Thread.ClientSocket.RemoteAddress);
  if AShowHost.Checked then
  begin
    Item.SubItems.Add(Thread.ClientSocket.RemoteHost);
    if Item.SubItems[1] = '' then Item.SubItems[1] := SHostUnknown;
  end else
    Item.SubItems.Add(SNotShown);
  if Thread is TServSocketThread then
  begin
    Item.SubItems.Add(DateTimeToStr(TServSocketThread(Thread).LastActivity));
  end;
  Item.Data := Pointer(Thread);
  UpdateStatus;
end;代码中最后第五行为什么不用Thread.LastActivity来引用属性呢?