title: protected members are not accessible through a pointer or object
body: <p>I have 2 classes <code>Training</code> and <code>Testing</code>, where <code>Training</code> is the base class and <code>Testing</code> is the derived class of <code>Training</code>. </p>
  
  <p>I have <code>Testing</code> class member function, <code>float totalProb(Training&amp; classProb, Training&amp; total)</code>, which takes 2 parameters, both are <code>Training</code> class objects. The code:</p>
  
  <pre><code>void Testing::totalProb(Training&amp; classProb, Training&amp; total) {
  
      _prob = (_prob * ((float)(classProb._nOfClass) / total._tnClass));
      cout &lt;&lt; "The probalility of the " &lt;&lt; it-&gt;first &lt;&lt; " beloning to " &lt;&lt; classProb._classType &lt;&lt; " is: " &lt;&lt; _prob &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Basically what this function does is calculate the probability of each document in <code>test1</code> (an object of <code>Testing</code> class) belonging to <code>class1</code> (an object of <code>Training</code> class).</p>
  
  <p>All the <code>Training</code> class (which is the base class) variables are <code>Protected</code> and all the <code>Training</code> class functions are <code>Public</code>. </p>
  
  <p>When I try to run <code>test1.totalProb(class1, total);</code> I get the error <code>Error C2248 'Training::_probCalc': cannot access protected member declared in class 'Training'</code>. I am unable to get around this.</p>