Is it possible to use constructor of class of diffrent object? Imagine two classes: A and B extends A. We make object
A x = new B(arg);
And then (pseudo-code!)
A y = new (x.getClass())(arg);
Can I reach this effect without iffing and casing through all possible inheritors of A?