title: Accessing Base class protected data member vector in derived class give error 139
body: <p>It may have been answered somewhere, but I could not find the correct words to search.</p>
  <p>I have base class</p>
  <pre><code>class B
  {
      protected:
          std::vector&lt;int&gt; v;
      public:
          B(): v{} {}
          void test()
          {
              v.push_back( 10 );
              std::cout &lt;&lt; v[0] &lt;&lt; std::endl; // prints 10
          }
  };
  </code></pre>
  <p>child class</p>
  <pre><code>class C: public B
  {
      public:
          C() {}
  
         void print() { std::cout &lt;&lt; v[0] &lt;&lt; std::endl; } // error here
  
  };
  </code></pre>
  <p>main function</p>
  <pre><code>int main() 
  { 
  
      B b;
      b.test(); // initialized vector 10
  
      C c;
      c.print(); // error 139 here
  
      return 0; 
  }
  </code></pre>
  <p>If I initialize vector in base constructor no error.</p>
  <pre><code>B(): v{ 10 } {}
  </code></pre>
  <p>I cannot figure out why? I may doing something really stupid, - assist me on error, I really appreciate it.</p>