Generics allow you to write code once that can
deal with any data type in a typesafe manner without the need for
typecasting.
TSomeClass<T> = class
private
FData : T;
procedure SetData(inData : T);
public
property Data : T read FData write SetData;
end;
var
a : TSomeClass<integer>;
b : TSomeClass<string>;
begin
a := TSomeClass<integer>.Create;
a.Data := 5;
a.Free;
b := TSomeClass<string>.Create;
b.Data := 'The rain in spain';
b.Free;