cannot understand the point of downcasting in the following code
David Schwartz
Greenhorn
Joined: May 28, 2008
Posts: 10
posted
0
how are you?
wanted to ask you why this code is using Downcasting (1st code fragment line 36-37)? i.e.
in the line below
should not the compiler dynamically 'find out' that it is dealing with a subclass of CurrentEmployee
and use the appropriate functions in that sub-class (BasePlusCommissionEmployee)?
thank you =================
You usually do it to call methods that a class has, but that its interface/super class has not. Methods getBaseSalary and setBaseSalary are called. Are these methods also in Employee ?