I am trying to constuct a class that will represent an employee. I believe my declaration matches the definition of the constructor. Why am I getting the below errors? why would they be invalid function declarations?
Code:
#include <iostream>
#include <iomanip>
using namespace std;
//class declaration
class Employee
{
private:
int idNum;
float payRate;
int maxHours;
public:
Employee (int = 45, float = 9.00, int = 40);
void changeData (int, float, int);
void displayData (int, float, int);
};
//class implementation section
Employee : : Employee (int id, float rate, int max) //unqualified-id before':' token
{
idNum = id;
payrate = rate;
maxhours = max;
}
void Employee : : changeData (int id, float rate, int max) //invalid function declaration
{
idNum = id;
payRate = rate;
maxHours = max;
return;
}
void Employee : : displayData() ////invalid function declaration
{
cout<< "The employee ID is ";
cout<< idNum << '/'
<< "The employee pay is ";
<< payRate << '/'
<< "The employee maximum hours are ";
<< maxHours << '/'
<< endl;
return;