unable to pass a pointer to a function between classes
<p>I'm attempting to pass a pointer to a function that is defined in one class into another class.  After much research, I believe my syntax is correct, but I am still getting compiler errors.  Here is some code which demonstrates my issue:</p>

<pre><code>class Base
{
public:
    BaseClass();
    virtual ~BaseClass();
};

class Derived : public Base
{
public:
    // assign strFunction to the function pointer passed in
    Derived(string (*funPtr)(int)) : strFunction(funPtr);
    ~Derived();

private:
    // pointer to the function that is passed in
    string (*strFunction)(int value);
};

class MainClass
{
public:
    MainClass()
    {
     // allocate a new Derived class and pass it a pointer to myFunction
     Base* myClass = new Derived(&amp;MainClass::myFunction); 
    }

    string myFunction(int value)
    {
     // return a string
    }
};
</code></pre>

<p>When I try to compile this code, the error I get is</p>

<blockquote>
  <p>error: no matching function for call to 'Derived::Derived(string (MainClass::*)(int))'</p>
</blockquote>

<p>followed by </p>

<blockquote>
  <p>note: candidates are: Derived::Derived(string (*)(int))</p>
</blockquote>

<p>Any idea what I might be doing wrong?</p>
