More ... // This works
function TestIsAs2<T: TObject>(Item: TObject): T; begin if Item is T then begin Exit(Item as T); end; Result := nil; end; Now before you say "of course" :) I find it interesting because is and as are operators, just like > greater than and < less than are operators. In previous examples no constraints were needed to use operators. Having said that, I am find with being forced to use a constraint with "as" and "is", because they are operators which cannot be overloaded. Good work!
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal