0
Why is downcasting important?
1 ответ
+ 2
Downcasting is used when you have to access a child class specific method but it has a parent class reference.
A subtype object with a parent class reference will only be able to access the parent class methods. The new methods or behaviour of the child class can be accessed only through downcasting.
A simple example.
https://code.sololearn.com/csPH1POSjRLI/?ref=app