定义一个员工类:包含如下内容,属性:姓名,工号,身份证,工资,工龄,毕业学校
时间: 2023-06-10 20:07:43 浏览: 117
以下是员工类的定义,包含姓名、工号、身份证、工资、工龄、毕业学校等属性:
```
class Employee:
def __init__(self, name, id_num, salary, seniority, school):
self.name = name
self.id_num = id_num
self.salary = salary
self.seniority = seniority
self.school = school
def get_name(self):
return self.name
def get_id_num(self):
return self.id_num
def get_salary(self):
return self.salary
def get_seniority(self):
return self.seniority
def get_school(self):
return self.school
def set_salary(self, new_salary):
self.salary = new_salary
def set_seniority(self, new_seniority):
self.seniority = new_seniority
def set_school(self, new_school):
self.school = new_school
```
以上是一个简单的员工类定义,其中包含了构造函数和一些获取和设置属性的方法。可以根据实际需要进行修改和扩展。
阅读全文