class
-члены по умолчанию являются частными в c ++. Если вы хотите получить к ним доступ напрямую, сделайте их доступными c:
class patient {
public:
string name;
int age = 0;//<-- don't leave those int's uninitialized ;)
int room = 0;
};
или объявите их как struct
:
struct patient {
string name;
int age = 0;
int room = 0;
};