本帖最后由 zhoubinjian 于 2016-3-31 13:28 编辑
/*姓名、工号以及工资为共有,可作父类,奖金属子类经理的成员,*/class Pro extends Employee
{
Pro(String name,String id,double pay)
{
super(name,id,pay);
// System.out.println(name+","+id+","+pay);
}
public void work()
{
System.out.println("Pro work");
}
}
abstract class Employee
{
String name;
String id;
double pay;
Employee(String name,String id,double pay)
{
this.name=name;
this.id=id;
this.pay=pay;
System.out.println(name+","+id+","+pay);
}
public abstract void work();
}
class Manager extends Employee
{
int bonus;
Manager(String name,String id,double pay,int bonus)
{
super(name,id,pay);
this.bonus=bonus;
System.out.println(name+","+id+","+pay+","+bonus);
}
public void work()
{
System.out.println("Manager work");
}
}
class Demo
{
public static void main(String[] agrs)
{
Manager z=new Manager("zhou","liushiu",4000,400);
}
}
|