std::bind and non-virtual call to base class method
<p>I want to use <code>std::bind</code> and do non-virtual call to base class function eg: <code>derived_obj.BaseClass::foo()</code></p>

<p><br>
Example: </p>

<p>Let's say I have base class <strong>A</strong> and derived class <strong>B</strong>. <strong>A</strong> has a virtual function <code>foo()</code> which is overridden by <strong>B</strong>.</p>

<pre><code>class A
{
   public:
     virtual void foo() { std::cout &lt;&lt; "Hello from A::foo()!";}
}

class B : public A
{
   public:
     void foo() overide { std::cout &lt;&lt; "Hello from B::foo()!";}
}
</code></pre>

<p>If I want to call <code>A::foo()</code> from object of class <strong>B</strong> I do non-virtual call:   </p>

<pre><code>B b_obj;
b_obj.A::foo(); // prints "Hello from A::foo()!"
</code></pre>

<p><br></p>

<p>Now I want to use <code>std::bind</code> and do non-virtual call to <code>A::foo()</code> from b_obj, how do I do this?</p>

<p>I've already tried by casting <code>b_obj</code> to <strong>A</strong> and use address of <code>&amp;A::foo()</code>, but had no luck.</p>

<pre><code>auto f = std::bind(&amp;A::foo, static_cast&lt;A*&gt;(&amp;b_obj));
f(); // prints "Hello from B::foo()!" but it should print "Hello from A::foo()!"
</code></pre>