get a reference to a containing class in java
<p>I am new to Java. I'm a C++ programmer, reading some Java code. I have this class definition:</p>

<pre><code>class Container {
    long ID;

    class Contained {
        void foo(){
            long parentID = ID;
        }
    }
}
</code></pre>

<p>I see that Contained can access any member of the Container class, simply by name.</p>

<p>I have one question:</p>

<p>What is going on here? In C++ these classes would be unrelated. But in Java, it seems, the contained class object seems to be implicitly tied to the instance of the parent class object.</p>

<p>Thanks
Manish</p>

<p>PS: Sorry, I know I could pick up a book on Java, but I was hoping someone could help me.</p>
