Function pointer, Functor or Lambda?
<p>I'm relatively new to C++, having spent years with Obj-C, and wondering about how to add what would be closure block in Obj-C, to a C++ class. Here's some pseudo code of what I want to do:</p>

<pre><code>class Slider
{
public:
    void onMouseDown()
    {
        if(rightClick or ctlKeyDown)
        {
            if(myFunctionPointer != nil)
            {
                // show popup menu
                myFunctionPointer(this);
            }
        }
    }

    FunctionPointer myFunctionPointer = nil;
};


class Editor
{
public:
    void showPopupMenu(Slider *s)
    {
        // build the popupMenu with information based on the slider
    }

    void init()
    {
        // create a slider and connect the popupMenu function to it
        mySlider = new Slider;
        mySlider-&gt;functionPointer = showPopupMenu();
    }

    Slider *mySlider;
};
</code></pre>

<p>As you can see, I'm trying to get my Slider class to call a function without knowing anything about it. </p>

<p>This shouldn't be that difficult, but I'm interested in doing it the best/proper way. Lambdas and functors look incredibly confusing. Maybe I'm looking for something else. But what?</p>