Some final questions about inheritance/casting
<p>I asked a question an hour or two ago that is similar but this is fundamentally different to me. After this I should be good.</p>

<pre><code>class base
{
private:
    string tame;
public:
    void kaz(){}
    virtual ~base() {}
    void print() const
    {
        cout &lt;&lt; tame &lt;&lt; endl;
    }
};

class derived: public base
{
private:
    string taok;
public:
    std::string name_;
    explicit derived( const std::string&amp; n ) : name_( n ) {}
    derived(){}
    void blah(){taok = "ok";}
    void print() const
    {
        std::cout &lt;&lt; "derived: " &lt;&lt; name_ &lt;&lt; std::endl;
    }
};

int _tmain(int argc, _TCHAR* argv[])
{
    base b;
    derived d;

    base * c = &amp;b;
    derived * e = (derived *)&amp;b;

    e-&gt;kaz();
    system("pause");


    return 0;
} 
</code></pre>

<p>I know downcasting in in this example is not good practice but I'm just using it as an example. So when I now am pointing to a base object from a derived pointer, I don't get why I am still able to do certain operations only belonging to the base class.</p>

<p>For example, the base class's interface has a Kaz() method but the derived method does not. When I downcast, why does the compiler not yell at me for doing this even though Kaz() is not part of the derived class's interface?</p>

<ol>
<li><p>Why is the compiler not complaining for using members of the base class when I am using a derived pointer?</p></li>
<li><p>Why does the compiler yell at me only when I access a member from the base class interface from within a method but not directly?</p></li>
</ol>

<p>For example:</p>

<p>I can't do this:</p>

<pre><code>e-&gt;print() //Program crashes
</code></pre>

<p>But I can do this:</p>

<pre><code>e-&gt;tame = "Blah";
cout &lt;&lt; e-&gt;tame &lt;&lt; endl;
</code></pre>
