C++ how to access a protected base class method through an instance of the derived class
<p>Given the following c++ classes:</p>

<pre><code>// base class
class A {
protected:
    void writeLogEntry(const std::string&amp; message);
};

// derived class
class B : public A { };

// c.h
class C {
   myMethod();
}

// c.cpp - uses B
C::myMethod()
{
    B b;
    b.writeLogEntry("howdy");
}
</code></pre>

<p>As expected, class C fails to compile with the error "cannot access protected member declared in class 'A'.</p>

<p>Should I a) make the method A::writeLogEntry public, or b) make a public method B::writeLogEntry(message) that passes the message param to A::writeLogEntry(message), or c) something else entirely?</p>

<p>Thanks</p>

<p>P</p>
