Access variables outside a class that extends another class
<p>How can I access variable outside a class that extends an other class that is used in an array list? I get an error that says that the variable does not exist in the extended class. Take a look, I want to access the variable members without having to declare it in my Object class:</p>

<pre><code>public abstract class Object {
    public int x, y;
}

public class House extends Object {
    public int members = 10;
}

// Somewhere else
ArrayList&lt;Object&gt; list = new ArrayList&lt;Object&gt;();
list.add( new House() );
for (Object o : list ) {
    o.members;
}
</code></pre>

<p>The problem is that in the RTS I'm writing, my Object class has over 40 variables, just because it doesn't work to declare them only in the sub class and access them from outside.
Hope you understand. How can I do this?</p>
