[java]代码库
abstract class Employee
{
String name;
float basic;
String address;
Employee()
{
}
Employee(String str,float sal,String addr)
{
name=str;
basic=sal;
address=addr;
}
void show()
{
System.out.println(name + " " + basic + " " + address);
}
}
class Manager extends Employee
{
String department;
Manager()
{
{
Manager(String str,float sal,String addr,String dept)
{
super(str,sal,addr);
department=dept;
}
void show()
{
super.show();
System.out.println(department);
}
}
class Director extends Employee
{
String transportAllowance;
Director()
{
{
Director(String str,float sal,String addr,String tA)
{
super(str,sal,addr);
transportAllowance=tA;
}
void show()
{
super.show();
System.out.println(transportAllowance);
}
}
public class Test
{
Test
{
}
public static void main(String [] args)
{
Manager objM=new Manager("aa",4000,"tt","manager");
System.out.println("m");
objM.show();
Director objD=new Director("bb",6000,"vv","director");
System.out.println("d");
objD.show();
}
}