c# delegate and abstract class
<p>I currently have 2 concrete methods in 2 abstract classes.  One class contains the current method, while the other contains the legacy method.  E.g.</p>

<pre><code>// Class #1
public abstract class ClassCurrent&lt;T&gt; : BaseClass&lt;T&gt; where T : BaseNode, new()
{
    public List&lt;T&gt; GetAllRootNodes(int i)
    {
      //some code
    }
}

// Class #2
public abstract class MyClassLegacy&lt;T&gt; : BaseClass&lt;T&gt; where T : BaseNode, new()
{
    public List&lt;T&gt; GetAllLeafNodes(int j)
    {
      //some code
    }
}
</code></pre>

<p>I want the corresponding method to run in their relative scenarios in the app.  I'm planning to write a delegate to handle this.  The idea is that I can just call the delegate and write logic in it to handle which method to call depending on which class/project it is called from (at least thats what I think delegates are for and how they are used).</p>

<p>However, I have some questions on that topic (after some googling):</p>

<p>1) Is it possible to have a delegate that knows the 2 (or more) methods that reside in different classes?
2) Is it possible to make a delegate that spawns off abstract classes (like from the above code)?  (My guess is a no, since delegates create concrete implementation of the passed-in classes)
3) I tried to write a delegate for the above code.  But I'm being technically challenged:</p>

<pre><code>    public delegate List&lt;BaseNode&gt; GetAllNodesDelegate(int k);
    GetAllNodesDelegate del = new GetAllNodesDelegate(ClassCurrent&lt;BaseNode&gt;.GetAllRootNodes);
</code></pre>

<p>I got the following error:</p>

<pre><code>An object reference is required for the non-static field, method, property ClassCurrent&lt;BaseNode&gt;.GetAllRootNodes(int)
</code></pre>

<p>I might have misunderstood something... but if I have to manually declare a delegate at the calling class, AND to pass in the function manually as above, then I'm starting to question whether delegate is a good way to handle my problem.</p>

<p>Thanks.</p>
