title: Why the derived class cannot access protected base class members?
body: <p>I have a base class (VectorRaw) and a derived class (Vector).</p>
  
  <p>I use operator new in the constructor of the base class to create a memory buffer and then placement new in the constructor of the derived class to place elements therein. </p>
  
  <p>The base class has its virtual destructor which cleans up if something in the constructor of the derived class goes wrong.</p>
  
  <p>When I try to compile it, there is an error: all of the base class' members (<code>begin, end, end_of_reserved</code>) are out of scope in all derived classes' functions. </p>
  
  <p>What am I doing wrong?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>template &lt;typename T&gt;
  class VectorRaw {
  protected:
      T * begin;
      T * end;
      T * end_of_reserved;
  
      VectorRaw(const size_t size) {
          begin = (T*) operator new (2 * size * sizeof(T));
          end = begin;
          end_of_reserved = begin + 2 * size;
      }
      virtual ~VectorRaw&lt;T&gt; () throw() {
          for (T * iter = begin; iter != end; ++iter) {
              iter-&gt;~T();
          }
          operator delete (begin);
          end_of_reserved = end = begin;
      }
  };
  
  template &lt;typename T&gt;
  class Vector : public VectorRaw&lt;T&gt; {
  public: 
      Vector(const size_t size, const T&amp; value) : VectorRaw&lt;T&gt;(size) {
          for (end = begin; end != begin + size; ++end)
              {   
              new (end) T (value);
          }
      }
      bool Empty() const throw() {
          return (begin == end);
      }
  };
  </code></pre>