Member objects - why are only public variables accessible?
<p>In the below code why should the variable i be public from class a? Why can't it be private or protected? I guess I am missing some basics of member objects. is it ?</p>

<pre><code>#include &lt;iostream&gt;

class a
{
public:
    int i;
};

class b
{
private:
    a a1;
public:
    void show()
    {
        a1.i=5; 
        std::cout &lt;&lt; a1.i;
    }
};

int _tmain(int argc, _TCHAR* argv[])
{
    b b1;
    b1.show();
    return 0;
}
</code></pre>
