Size difference between base class and derived class
<pre><code>int x=22;
long z=24;
//now in this case int is smaller than long so
z=x; // is quite appropriate as it implicitly converts from int to long(widening)
</code></pre>

<p>Similarly we have classes like this:</p>

<pre><code>private static class Box {
    private int width;
    private int height;
    private int length;
    //...
}

private static class WeightBox extends Box {
    private int weight;
    //...
}

public class Main {
    public static void main(String args[]) {
        Box simpleBox = new Box();
        WeightBox wt = new WeightBox();
        simpleBox = wt; //we can always do this
        //wt = simpleBox cannot be done implicitly 
        //for this to work we have to use type casts
    }
}
</code></pre>

<p>Why is it that <code>simpleBox = wt</code> can be done even though simpleBox belongs to the base class and wt belongs to the extended class; shouldn't the extended class be bigger than the base class?</p>
