Abstract Functors in C++
<p>I would like to write an abstract base class</p>

<pre><code>class func_double_double_t : public unary_function&lt;double, double&gt;
{
    virtual double operator()(double x) = 0;
};
</code></pre>

<p>and specialize it for several different types</p>

<pre><code>class func_pow_t : public func_double_double_t
{
 public:
    func_pow_t(double exponent) : exponent_(exponent) {};
    virtual double operator()(double x) { return pow(x, exponent_); };
}

class func_exp_t : public func_double_double_t
...
</code></pre>

<p>and pass these to a function when necessary: </p>

<pre><code>double make_some_calculation(double num, func_double_double_t f)
{
     return f(x);
}
</code></pre>

<p>But I can't define an object of type <code>func_double_double_t</code> because it's abstract. I can pass a pointer to the function, but using <code>f</code> like <code>f-&gt;operator()(num)</code> seems against the spirit of operator overloading in the first place. (<code>(*f)(num)</code> is better, but still.) </p>

<p>Is there way to make operator overloading and such abstraction play nicely together? </p>
