设计一个patient类c++
时间: 2023-12-17 14:04:33 浏览: 31
好的,以下是一个简单的Patient类的C++代码示例:
```
class Patient {
private:
string name;
int age;
string gender;
string address;
string phone;
public:
// 构造函数
Patient(string name, int age, string gender, string address, string phone) {
this->name = name;
this->age = age;
this->gender = gender;
this->address = address;
this->phone = phone;
}
// 普通函数
void display() {
cout << "Name: " << name << endl;
cout << "Age: " << age << endl;
cout << "Gender: " << gender << endl;
cout << "Address: " << address << endl;
cout << "Phone: " << phone << endl;
}
};
```
以上代码实现了一个简单的Patient类,包含了病人的姓名、年龄、性别、地址和电话等信息,并提供了一个显示信息的函数。请注意,这只是一个简单的示例,实际情况下可能需要更多的属性和方法来满足需求。