C++ Store function as Variable on the fly : <p>I am wondering if there is any way to create a function as a variable or change a class's function on the fly. Here are some examples to show what I mean</p>

<p>Java</p>

<pre><code>Thread t = new Thread() {
    public void run() {
        //do something
    }
}
</code></pre>

<p>Javascript</p>

<pre><code>var f = function() {
    //do something
}
</code></pre>

<p>I am aware that you can use a predefined function as a variable, but I'm looking to do this entirely in a function.</p>
