110,533
社区成员
发帖
与我相关
我的任务
分享
public class Person
{
static private long count = 0;
private string id; //11身份证号码
private string name;
public Person()
: this("")
{
}
public Person(string name)
{
++Person.count;
this.id = string.Format("{0:00000000000}", Person.count);//11为身份证号码
this.name = name;
}
}
public class Worker: Person
{
static private long count = 0;
private string workerId; //四位工号
private double salary; //薪水
public Worker()
: this("", 0.0)
{
}
public Worker(string name, double salary)
: base(name)
{
++Worker.count;
this.workerId = string.Format("{0:0000}", Worker.count);
this.salary = salary;
}
}