+ 1
Is it something like this kindly help
A object = new B(); // reference of class A but calling B class constructor so creating object of Class B using reference of class A. B b = (B) object; // so if we create totally b class object then we will create like B b = new B(); As we can see new B(); is already initialized in object.
2 Réponses
+ 3
If B is a subclass of A, then your code is fine. The comments are accurate for that code.
+ 1
Yes, it is.
Thanks