How to implement fluent interface with a base class, in C++
<p>How can I implement this fluent interface in C++:</p>

<pre><code>class Base {
public:
  Base&amp; add(int x) {
    return *this;
  }
}

class Derived : public Base {
public:
  Derived&amp; minus(int x) {
    return *this;
  }
}

Derived d;
d.add(1).minus(2).add(3).minus(4);
</code></pre>

<p>Current code doesn't work since Base class doesn't know anything about Derived class, etc. I would be very thankful for a hint/suggestion.</p>
