This is the exact header file as it was given to me:
Code:
#ifndef CCC_EMPL_H
#define CCC_EMPL_H
#include <string>
using namespace std;
class Employee
{
public:
/**
Constructs an employee with empty name and no salary.
*/
Employee();
/**
Constructs an employee with a given name and salary.
@param employee_name - the employee name
@param initial_salary - the initial salary
*/
Employee(string employee_name, double initial_salary);
/**
Sets the salary of this employee.
@param new_salary the new salary value
*/
void set_salary(double new_salary);
/**
Gets the salary of this employee.
@return the current salary
*/
double get_salary() const;
/**
Gets the name of this employee.
@return the employee name
*/
string get_name() const;
/**
The sorting function which compares two employees by name.
@param a The first employee
@param b The second employee
@return true if the first employee's salary is less
*/
bool sortByName (Employee a , Employee b);
/**
The sorting function which compares two employees by salary.
@param a The first employee
@param b The second employee
@return true if the first employee's salary is less
*/
bool sortBySalary (Employee a , Employee b);
private:
string name;
double salary;
};
#endif
The version I have now though has the 'std::string' added as well as the 'using namespace std;' removed. I've also added in the 'const Employee& a and b '
Code:
/**
Gets the name of this employee.
@return the employee name
*/
std::string get_name() const;
/**
The sorting function which compares two employees by name.
@param a The first employee
@param b The second employee
@return true if the first employee's salary is less
*/
bool sortByName (const Employee& a , const Employee& b);
/**
The sorting function which compares two employees by salary.
@param a The first employee
@param b The second employee
@return true if the first employee's salary is less
*/
bool sortBySalary (const Employee& a , const Employee& b);
private:
std::string name;
double salary;