Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-11

Question on method pointers

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

I have a question regarding the assignment of the result of a function. The function is declared as such:

TMyFunc = function : extended of Object;

I have a variable that is of this type and I want to assign the result of this function to a variable of type extended. I was thinking to do it like this;

var MyFuncVar: TMyFunc;
....
MyResult := MyFuncVar;

But obviously it does not work. On delphi it does, so how can I make it work on FPC??

Kind regards, Darius Blaszijk

Jonas Maebe
to Unknown author
Show quoted text 13 lines
I have a variable that is of this type and I want to assign the result of this function to a variable of type extended. I was thinking to do it like this; var MyFuncVar: TMyFunc; .... MyResult := MyFuncVar; But obviously it does not work. On delphi it does, so how can I make it work on FPC??

It should work in Delphi mode. In other modes, use

MyResult := MyFunc();

(which also works in Delphi if I'm not mistaken)

Jonas

Unknown author
to Jonas Maebe

It works, thanks

Show quoted text 29 lines
On 05 Nov 2005, at 20:21, wrote: > I have a variable that is of this type and I want to assign the > result of > this function to a variable of type extended. I was thinking to do > it like > this; > > var MyFuncVar: TMyFunc; > .... > MyResult := MyFuncVar; > > But obviously it does not work. On delphi it does, so how can I > make it > work on FPC?? It should work in Delphi mode. In other modes, use MyResult := MyFunc(); (which also works in Delphi if I'm not mistaken) Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal