Quote:
Originally Posted by Ouroboroz
Wait would casting MonoImage into BinaryImage work too?
|
No, because you can only downcast an object if it was that type to begin with.
Code:
class A {}
class B extends A {}
public static void main(String[] args){
A a1 = new B();
B a1_b = (B) a1; // ok
A a2 = new A();
B a2_b = (B) a2; // ClassCastException
}
More info:
https://docs.oracle.com/javase/tutor...ubclasses.html