F
Franck DARRAS
Hello,
I have two classes
ClassA and ClassB
ClassB extends ClassA
When i creat a new ClassB, I can cast this ClassB to the ClassA
code : ClassA classA = (classA) ClassB;
Problem :
But I would like to create a new instance of ClassA and cast it to the
ClassB, but i obtain a classCastException.
Do you know a solution ?
For the moment, I resolve this problem with this follow code
ClassB classB = new ClassB();
classB.setXXX(ClassA.getXXX);
Thks for your Help
Franck
I have two classes
ClassA and ClassB
ClassB extends ClassA
When i creat a new ClassB, I can cast this ClassB to the ClassA
code : ClassA classA = (classA) ClassB;
Problem :
But I would like to create a new instance of ClassA and cast it to the
ClassB, but i obtain a classCastException.
Do you know a solution ?
For the moment, I resolve this problem with this follow code
ClassB classB = new ClassB();
classB.setXXX(ClassA.getXXX);
Thks for your Help
Franck