本帖最后由 jinhuikang 于 2015-2-14 23:03 编辑
abstract class Employee
{
private String name;
private String id;
private double pay;
Employee(String name,String id,double pay)
{
this.name=name;
this.id=id;
this.pay=pay;
}
public abstract void work();
}
class Manager extends Employee
{
private int bonus;
Manager(String name,String id,double pay,int bonus)
{
super(name,id,pay);
this.bonus=bonus;
}
public void work()
{
System.out.println("manager work");
}
}
class Pro extends Employee
{
Pro(String name, String id, double pay)
{
super(name, id, pay);
}
public void work()
{
System.out.println("pro work");
}
}
class JichengChongxie
{
public static void main(String[] args)
{
Pro p=new Pro("zhangsan", "001", 5000);
p.work();
Manager m=new Manager("lisi", "002", 8000, 3000);
m.work();
}
} |
|