0

Why is downcasting important?

10th Jun 2020, 1:35 PM
Dipesh Das
Dipesh Das - avatar
1 Antwort
+ 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
10th Jun 2020, 3:46 PM
Avinesh
Avinesh - avatar