As we discussed earlier, to avoid side effects, we have to design our class to be an immutable object. We will refactor the previous MutableEmployee class. Let's take a look at the following header class:
/* immutableemployee.h */ #ifndef __IMMUTABLEEMPLOYEE_H__ #define __IMMUTABLEEMPLOYEE_H__ #include <string> class ImmutableEmployee { private: int m_id; std::string m_firstName; std::string m_lastName; double m_salary; public: ImmutableEmployee( const int id, const std::string& firstName, const std::string& lastName, const double& _salary); ImmutableEmployee(); const int Id() const { return m_id; } const std::string& FirstName() const { return m_firstName; } const std::string& LastName() ...