class Employee{
protected String name;
protected double basic;
protected String address;
Employee(String n,double money,String a){
name=n;
basic=money;
address=a;
}
protected void show(){
System.out.println("\n\n经理详细信息");
System.out.println("========================================");
System.out.println("姓名:"+name);
System.out.println("地址:"+address);
System.out.println("薪资:"+basic);
}
}
class Manager extends Employee{
String department;
Manager(String n,double money,String a,String part){
super(n,money,a);
department=part;
}
void show(){
super.show();
System.out.println("部门:"+department);
}
}
class EmployeeTest{
public static void main(String []args){
Manager mgrObj=new Manager("Henry",5500.65,"Sydney","会计部");
mgrObj.show();
}
}
我刚编的没能通过JAVAC他说问题在于父类方法SHOW是保护状态Manager类不能用他,可Manager是Employee的子类啊?
为什么子类不能调用父类的方法呢?