JAVA: How to access another object's subclass?
<p>I have an instance of the object VMemRead (let's call it r).  The constructor for VMemRead looks like</p>

<pre><code>VMemRead(SourcePos sourcePos, VVarRef dest, VMemRef source)
</code></pre>

<p>with fields <code>dest</code> and <code>source</code>.  I know when I want to access dest, I can just do <code>r.dest</code>.  However, I want to go "deeper" into source.</p>

<p>VMRef has two nested classes <code>VMemRef.Global</code> and <code>VMemRef.Stack</code>.  VMemRef.Global has the constructor</p>

<pre><code>VMemRef.Global(SourcePos sourcePos, VAddr&lt;VDataSegment&gt; base, int byteOffset)  
</code></pre>

<p>I want to access the <code>int byteOffset</code>.  In effect, I want to do something like <code>r.source.Global.byteOffset</code> but Java doesn't let me do this.  </p>

<p>Is there any way I can access that value?</p>

<p>Documentation:
VMemRead: <a href="http://cs.ucla.edu/classes/spring11/cs132/kannan/vapor-parser/vapor-parser-javadoc/cs132/vapor/ast/VMemRead.html#source" rel="nofollow">http://cs.ucla.edu/classes/spring11/cs132/kannan/vapor-parser/vapor-parser-javadoc/cs132/vapor/ast/VMemRead.html#source</a></p>

<p>VMemRef: <a href="http://cs.ucla.edu/classes/spring11/cs132/kannan/vapor-parser/vapor-parser-javadoc/cs132/vapor/ast/VMemRef.html" rel="nofollow">http://cs.ucla.edu/classes/spring11/cs132/kannan/vapor-parser/vapor-parser-javadoc/cs132/vapor/ast/VMemRef.html</a></p>

<p>VMemRef.Global: <a href="http://cs.ucla.edu/classes/spring11/cs132/kannan/vapor-parser/vapor-parser-javadoc/cs132/vapor/ast/VMemRef.Global.html" rel="nofollow">http://cs.ucla.edu/classes/spring11/cs132/kannan/vapor-parser/vapor-parser-javadoc/cs132/vapor/ast/VMemRef.Global.html</a></p>

<p>Thank you very much!</p>
