How to assign an overloaded class method to anonymous method? : <p>In Delphi, we can assign a class method (declared as <code>procedure of object</code>) as parameter of type anonymous method.</p>

<p>For overloaded methods (same method names), passing the object method fail with compilation error:</p>

<pre><code>[dcc32 Error] Project56.dpr(40): E2010 Incompatible types: 'System.SysUtils.TProc&lt;System.Integer,System.Integer&gt;' and 'Procedure of object'
</code></pre>

<p>The following example show the situation.  Is that possible to let the overloaded method pass as anonymous method parameter?</p>

<pre><code>type
  TTest = class
  public
    procedure M(a: Integer); overload;
    procedure M(a, b: Integer); overload;
  end;

procedure TTest.M(a, b: Integer);
begin
  WriteLn(a, b);
end;

procedure TTest.M(a: Integer);
begin
  WriteLn(a);
end;

procedure DoTask1(Proc: TProc&lt;Integer&gt;);
begin
  Proc(100);
end;

procedure DoTask2(Proc: TProc&lt;Integer,Integer&gt;);
begin
  Proc(100, 200);
end;

begin
  var o := TTest.Create;
  DoTask1(o.M);  // &lt;-- Success
  DoTask2(o.M);  // &lt;-- Fail to compile: E2010 Incompatible types: 'System.SysUtils.TProc&lt;System.Integer,System.Integer&gt;' and 'Procedure of object'
  ReadLn;
end.
</code></pre>
