title: Why can't I access a protected member from an instance of a derived class?
body: <p>I haven't done C++ in a while and can't figure out why following doesn't work:</p>
  
  <pre><code>class A {
  protected:
    int num;
  };
  
  class B : public A {
  };
  
  main () {
    B * bclass = new B ();
    bclass-&gt;num = 1;
  }
  </code></pre>
  
  <p>Compiling this produces: </p>
  
  <blockquote>
    <p>error C2248: 'A::num' : cannot access protected member declared in class 'A'</p>
  </blockquote>
  
  <p>Shouldn't protected members be accessible by derived classes?</p>
  
  <p>What am I missing?</p>