Problem Source: http://www.cnblogs.com/del/archive/2008/07/30/1039045.html#1272783
In the compiler's opinion, the overloaded functions are basically different functions, of course there will be different function addresses; the addresses we get in the conventional method are only the first overloaded addresses.
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs; Type tform1 = Class (tform) Procedure formcreate (Sender: tobject); end; vaR form1: tform1; implementation {$ R *. DFM} {example two overloaded functions} function myfun (S: string): string; overload; begin result: = s; end; function myfun (I: integer): string; overload; begin result: = inttostr (I); end; {obtain the address of the overload function respectively} procedure tform1.formcreate (Sender: tobject); type {two method types need to be defined first, the parameters correspond to the above overload functions} TF1 = function (s: string): string; TF2 = function (I: integer): string; var F1: TF1; {reload 1} F2: TF2; {reload 2} S1, S2: string; begin F1: = myfun; {Let F1 point to reload 1} F2: = myfun; {Let F2 point to reload 2} {test function} S1: = F1 ('abc'); S2: = F2 (123); showmessagefmt ('% s, % s ', [S1, S2]); {ABC, 123} {the first two values are the addresses of the two overloaded functions. The third value is obtained based on the function name, it is the same as the address of the first overload} showmessagefmt ('% P, % P, % P', [@ F1, @ F2, @ myfun]); {another method} showmessagefmt ('% P, % P, % P', [ADDR (F1), ADDR (F2), ADDR (myfun)]); {if it is a method in the published area, you can also use methodaddress to obtain the address} end; end.