Hi,
Is it possible to do the following:
=== example ===
program test;
type
? TMyClass = class
? type
? ? TDataFilter = function?
? public
? ? Value : Double;
? ? Filter: TDataFilter;
? ? procedure ViewData;
? end;
procedure TMyClass.ViewData;
begin
? if Filter = nil then
? ? WriteLn(Value)
? else
? ? WriteLn(Filter(Value));
end;
var
? t : TMyClass;
begin
? t := TMyClass.Create;
? t.Value = 2;
? t.Filter := @sqr; ? //this does not work
? t.Filter := @ln; ? ?//this does not work either
? t.ViewData;
? t.Free;
end.
=========The problem is, while assign function pointers to Filter, I would like to make it accept all numeric functions. ?That is, if I define it to accept Double, it should accept Single and Integers, and if I define it to accept Extended, it should accept all numbers.
Possible?
Thanks,
Shannon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130227/8896a1b4/attachment.html>
