# 一.编写出要创建一个员工类Employee。 # 这个类中的一个成员变量应该包括员工号empNum、姓名Name; # 其操作方法一个是用来设置set员工的工号, # 另一个操作方法是用来取得get员工工号。 class Employee: def __init__(self): self.__empnum=None self.__name=None def set_empnum(self,empnum): if isinstance(empnum,int): self.__empnum=empnum else: return self.__empnum def get_empnum(self): print(self.__empnum) p=Employee() p.set_empnum("1101") p.get_empnum()
python作业题
于 2022-10-20 11:40:30 首次发布