calling a protected virtual method in C++
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/448258/calling-virtual-method-in-base-class-constructor">Calling virtual method in base class constructor</a><br>
  <a href="http://stackoverflow.com/questions/962132/calling-virtual-functions-inside-constructors">Calling virtual functions inside constructors</a>  </p>
</blockquote>



<p>How can I call a protected virtual method from a constructor in C++?</p>

<pre><code>class Foo
{
   Foo(){
       printStuff();  // have also tried this-&gt;printStuff()
   }
  protected:
   virtual void printStuff() {}
}

class ExtendedFoo : public Foo {
  protected:
   virtual void printStuff() { cout &lt;&lt; "Stuff" &lt;&lt; endl;}
}

...

ExtendedFoo exFoo; // should print "Stuff"
</code></pre>
