- 2
A a = new A and B b = new B and a=b is that mean that's A a = new B ???
4 ответов
+ 1
Maybe, try it in the editor.
+ 1
Works if B extends A.
+ 1
Also works if both A and B are extended from the same parent or at least have a common ancestor. On some level it will work (but not necessarily the way you want it to) because all classes inherit from Object.
0
yes is important to extends A thanks