previous |
start |
next
Invoking Superclass Methods
- Can't access private fields of superclass
public class Manager extends
Employee
{
public double
getSalary()
{
return salary + bonus; //
ERROR--private field
}
...
}
- Be careful when calling superclass method
public double
getSalary()
{
return getSalary() + bonus;
// ERROR--recursive call
}
previous |
start |
next