public class Manager extends position implements Job{
public String getMessage(String name){
return"姓名: "+name+"(manager)";}
public String getMessage1(String wage){
return"工资: "+wage;
}
//以上体现了方法重写
public static void main(String[] args) {
Position zzc=new Manager();//这为什么错了
//Position zzc=new Waiter();
//Position zzc=new Cook();
//以上体现了多态
zzc.setName("张志成");
zzc.setWage("10000");
zzc.setAccount("6212260503569565601");
String message = zzc.getMessage(zzc.getName());
String message1 = zzc.getMessage1(zzc.getWage());
System.out.println(message);
System.out.println(message1);
}
public String getJobMessage() {
return";工作项目:管理";
}
}
Finit
wldraa
相关分类