Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
Delphi 4 introduced function and method overloading and added one problem: How do you get a pointer to an particular overlaoded method / function.
unit1; interface function add(n1,n2 : integer):integer;overload; function add(f1,f2 : double):double;overload; implementation ... end.
Is there a way to get address of second add (with double) function ?
Unit2; interface uses Unit1; function addr1:Pointer; implementation function addr1:pointer; begin Result:=@Add; end; end.
addr1 returns first add's address, how can I obtain seconds ?
type TDoubleFunc = function(f1,f2:double):double; function addr2:pointer; var f:TDoubleFunc; begin f := Add; Result:=@f; end;
(Curtesy of Marc Rohloff [TeamB])