1》定义标准的医生类:id、name、subject、sex 定义方法:check方法,检查病人,入参Person的对象 方法操作为输出病人的个人信息
时间: 2023-06-23 11:10:03 浏览: 111
以下是一个可能的医生类的定义,包括id、name、subject和sex属性,以及check方法:
```python
class Doctor:
def __init__(self, id, name, subject, sex):
self.id = id
self.name = name
self.subject = subject
self.sex = sex
def check(self, person):
print(f"Patient's personal information: ID: {person.id}, Name: {person.name}, Age: {person.age}, Sex: {person.sex}")
```
在这个类中,我们定义了一个构造函数来初始化医生对象的属性,以及一个check方法来输出病人的个人信息。这个check方法接受一个Person对象作为参数,并使用该对象的属性来输出个人信息。请注意,这里的Person类没有定义,因此我们需要假设它已经被定义并可用。
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![cpp](https://img-home.csdnimg.cn/images/20250102104920.png)
![doc](https://img-home.csdnimg.cn/images/20241231044833.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![application/msword](https://img-home.csdnimg.cn/images/20210720083327.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044901.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)