声明一个patient 类
时间: 2024-05-10 13:14:30 浏览: 45
好的,以下是一个简单的Patient类的Python代码示例:
```python
class Patient:
def __init__(self, name, age, gender, address, phone):
self.name = name
self.age = age
self.gender = gender
self.address = address
self.phone = phone
def get_name(self):
return self.name
def set_name(self, name):
self.name = name
def get_age(self):
return self.age
def set_age(self, age):
self.age = age
def get_gender(self):
return self.gender
def set_gender(self, gender):
self.gender = gender
def get_address(self):
return self.address
def set_address(self, address):
self.address = address
def get_phone(self):
return self.phone
def set_phone(self, phone):
self.phone = phone
```
以上Patient类包含了一些基本的属性和方法,包括姓名、年龄、性别、地址和电话等属性,以及对这些属性进行读取和修改的方法。可以根据具体需求对该类进行扩展。
阅读全文