How to do unit testing on private members (and methods) of C++ classes [duplicate]
This question already has an answer here: How do I test a private function or a class that has private methods, fields or inner classes? 50 answers I am very new to unit testing and I am a little confused. I am trying to do unit testing (using the Boost unit testing framework) on a C++ class called VariableImpl . Here are the details. class Variable { public: void UpdateStatistics (void) { // compute mean based on m_val and update m_mean; OtherClass::SendData (m_mean); m_val.clear (); } virtual void RecordData (double) = 0; protected: std::vector<double> m_val; private: double m_mean; }; class