title: dynamic_cast doubt from C++/Stroustrup : converting to protected base class
body: <p>I know that following code gives compilation error : </p>
  
  <pre><code>class A{ public : virtual void name(){cout&lt;&lt;typeid(this).name()&lt;&lt;endl;}; };
  class B:protected A{public : virtual void name(){cout&lt;&lt;typeid(this).name()&lt;&lt;endl;};};
  void foo(B* b)
  {
      A * a = dynamic_cast&lt;A*&gt;(b); //Error : 'A' is an inaccessible base of 'B'    
      return;
  }
  </code></pre>
  
  <p>But then why in the C++ Stroustrup book (15.4.1) he writes </p>
  
  <pre><code>class BB_ival_slider:public Ival_slider,protected BBslider{ //...
  };
  void f(BB_ival_slider*p)
  {  
  // ok 
  BBslider* pbb2 = dynamic_cast&lt;BBslider*&gt;(p);    // ok: pbb2 becomes 0
  }
  </code></pre>
  
  <p>Shouldn't the line be compilation error  ?
  So either my gcc is wrong in flagging it as compilation error OR the unthinkable, stroustrup typo or most plausibly I have missed something...</p>