有一个类 TPerson。众所周知,FSecondName 对每个对象都是唯一的。
type
TPerson = class(TObject)
private
FAge: Integer;
FFirstName: String;
FSecondName: String;
public
property Age: Integer read FAge;
property FirstName: String read FFirstName;
property SecondName: String read FSecondName;
constructor Create;
end;
如何添加类字段(如 C# 中的静态字段) Persons: TDictionary (String, TPerson),其中键是 SecondName,值是类 TPerson 的对象。
谢谢!