I created the following simple class in my code and I get “TObject is not a valid constraint” error message.
TTest = class
class function Test<T:TObject>(Dummy: integer): string;
end;
...
class function TTeste.Teste<T>(Dummy: integer): string;
begin
Result := 'Compiled';
end;
What I’m doing wrong? Is this possible? (You can include option available on later versions than D2010, since we’ll receive our XE2 licenses in the next 2 weeks).
Try the
classconstraint:It might not only accept normal classes, but also interfaces with that constraint(in C# it does, and Delphi generics imitate C# generics).