class Employee
{
public:
int GetAge() const;
void SetAge(int age);
int GetYearsOfService() const;
void SetYearsOfService(int years);
int GetSalary() const;
void SetSalary(int salary);
private:
int itsAge;
int itsYearsOfService;
int itsSalary;
};
And then this executable code.
#include <iostream>
#include "Employee.h"
int Employee::GetAge() const
{
return itsAge;
}
void Employee::SetAge(int age)
{
itsAge = age;
}
int Employee::GetYearsOfService() const
{
return itsYearsOfService;
}
cout << "At AcmeSexist Company, two employees, John and Sally, work together.\n";
cout << "John is " << John.GetAge() << "years old.\n";
cout << "He worked with the Company for " << John.GetYearsOfService() << "years.\n";
cout << "He earns a salary of $" << John.GetSalary() << ".\n\n";
cout << "Sally is " << Sally.GetAge() << "years old.\n";
cout << "She worked with the Company for " << Sally.GetYearsOfService() << "years.\n";
cout << "Though she worked longer, she only earns a salary of $" << Sally.GetSalary << ".\n";
char response;
cin >> response;
return 0;
}
I try to build this and an error pops up.
error C3867: 'Employee::GetSalary': function call missing argument list; use '&Employee::GetSalary' to create a pointer to member
I made this program as a workshop in a c++ book to teach myself. this is actually almost the exact copy of the coy in the book that they give for the same compiler I'm using. I don't know what to do, because when I put "&" before Employee::GetSalary like it says to, more errors pop up. Can someone help me?
cout << "Sally is " << Sally.GetAge() << "years old.\n";
cout << "She worked with the Company for " << Sally.GetYearsOfService() << "years.\n";
cout << "Though she worked longer, she only earns a salary of $" <<