C++ -- Questions about "protected inheritance"
<p>I assume that I understand the meaning of "protected inheritance". However, after discussing this issue with one folk here, I feel a little confused now.</p>

<p>Here is my understanding of "protected inheritance" in c++</p>

<p>Assume the following class structure.</p>

<pre><code>class Base {}
class SubClass : protected Base {}
</code></pre>

<p>1> If a subclass is defined as "protected BaseClass", then this subclass is no longer a subclass of the BaseClass. Instead, the BaseClass only serves as a utility tool for the subclass. In other word, if you cast SubClass* to Base*, SubClass&amp; to Base&amp;, or SubClass to Base, you should expect an error.</p>

<p>2> The major reason why people use protected inheritance is that the expected SubClass is NOT a subclass of the Base (For example, Car is not a subclass of Engine). While, in the same time, SubClass wants to call the functions defined in the Base class.</p>

<p>3> There is a good reason sometimes you prefer to using protected inheritance rather than define a member variable as an object of the Base. (but I don't remember in which case).</p>

<p>Please correct my comments if I am wrong.</p>

<p>thank you</p>
