title: C++: Overriding a protected method which is called by another method
body: <p>I have a very basic question concerning inheritance in C++:</p>
  
  <pre><code>class A
  {
  public:
    void foo() { print(); }
  protected:
    void print() {}
  };
  
  class B : public A
  {
  protected:
    void print() { std::cout &lt;&lt; "test" &lt;&lt; std:: endl; }
  };
  </code></pre>
  
  <p>Now the following code</p>
  
  <pre><code>B b;
  b.foo();
  </code></pre>
  
  <p>doesn't print anything, so foo() obviously didn't call the newly defined print(). Is this only solvable by using virtual methods?</p>