I read some of the past forum posts but none of them quite get to what I am trying to figure out. I have the following classes:
With the following to test a few things:
I understand the concept of why a manager object uses the getSalary method in the manager class and why an employee will use the employee method.
I also understand why an employee cannot access manager methods but a manager can access employee methods. What I do not understand.
When I created an Employee and assigned a Manager type to it.
1. It created an employee, I am ok so far.
2. It uses the Manager getSalary. I am not ok with this.
3. Attempts to access the setBonus method in manager fails
It seems like the instance I called em is both a manager and an employee depending on what it wants to do. I don't understand why it calls the manager getSalary but will not allow code to call manager methods.
I mark the areas of the code that I don't understand why they act as they do with
hopefully that will make it easier to follow.