Take a look at the following source code:
#include <iostream>
#include <string>
#ifndef _PATIENT_H_
#define _PATIENT_H_
#include "Base.cpp"
class Patient: public Base
{
private:
std::string name_;
std::string date_of_birth_;
std::string sex_;
public:
void set_name(std::string & name)
{
name_ = name;
}
std::string get_name() const
{
return name_;
}
void set_date_of_birth(std::string & date_of_birth)
{
date_of_birth_ = date_of_birth;
}
std::string get_date_of_birth() const
{
return date_of_birth_;
}
void set_sex(std::string & sex)
{
sex_ = sex;
}
std::string get_sex() const
{
return sex_;
}
};
#endif
I have two questions here:
- Should
#include <iostream>
and#include <string>
be inside#define _PATIENT_H_
? - In the setter accessors, how should I write the
const
keyword:
a.void set_name(const std::string & name)
b.void set_name(std::string const & name)
?