[fpc-pascal] Feature announcement: Generic functions, procedures and methods
sysrpl at gmail.com
Mon Nov 23 01:30:47 CET 2015
// This works
function TestIsAs2<T: TObject>(Item: TObject): T;
if Item is T then
Exit(Item as T);
Result := nil;
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal