wrote:
> Ok fine, just comment out draw2, and even the problem
> remains.................
To expand a bit:
class A consists of only things defined in A.
class B consists of things defined in A and B.
So A can only be A, but B can be both A and B.
In other words "references must be the same or from a super class" for
it to work, which means that the reference can hold any objects of sub
class type. You can not do it the other way around.
If you had done the following, the down casting would have worked:
B b = new B()
A ab = b;
B b2 = (B)ab;
So what you need to do is either do a new B() or redefine it to be an A
reference.
/tom