R
Richard
I get this error message:
Error E2235 EX3.CPP 60: Member function must be called or its address taken in
function main()
From these code:
#include<iostream.h>
class Employee {
public:
int GetAge();
void SetAge(int age);
int GetYearsOfService();
void SetYearsOfService(int yearsOfService);
int GetSalary();
void SetSalary(int Salary);
private:
int myage;
int myyearsOfService;
int mySalary;
};
int Employee::GetAge()
{
return myage;
}
void Employee::SetAge(int age)
{
myage = age;
}
int Employee::GetYearsOfService()
{
return myyearsOfService;
}
void Employee::SetYearsOfService(int yearsOfService)
{
myyearsOfService = yearsOfService;
}
int Employee::GetSalary()
{
return mySalary;
}
void Employee::SetSalary(int Salary)
{
mySalary = Salary;
}
void main (void)
{
Employee John;
Employee Sally;
John.SetAge(30);
John.SetYearsOfService(5);
John.SetSalary(50000);
Sally.SetAge(32);
Sally.SetYearsOfService(8);
Sally.SetSalary(40000);
cout << "John is " << John.GetAge << " years old and he has been with";
cout << " the firm for " << John.GetYearsOfService << " years\n";
cout << "John earns $" << John.GetSalary << " dollars a year.\n\n";
cout << "Sally is " << Sally.GetAge << "years old and she has been with";
cout << " the firm for " << Sally.GetYearsOfService << " years\n";
cout << "Sally earns $" << Sally.GetSalary << " dollars a year\n\n";
}
What's wrong?
Thanks!
Error E2235 EX3.CPP 60: Member function must be called or its address taken in
function main()
From these code:
#include<iostream.h>
class Employee {
public:
int GetAge();
void SetAge(int age);
int GetYearsOfService();
void SetYearsOfService(int yearsOfService);
int GetSalary();
void SetSalary(int Salary);
private:
int myage;
int myyearsOfService;
int mySalary;
};
int Employee::GetAge()
{
return myage;
}
void Employee::SetAge(int age)
{
myage = age;
}
int Employee::GetYearsOfService()
{
return myyearsOfService;
}
void Employee::SetYearsOfService(int yearsOfService)
{
myyearsOfService = yearsOfService;
}
int Employee::GetSalary()
{
return mySalary;
}
void Employee::SetSalary(int Salary)
{
mySalary = Salary;
}
void main (void)
{
Employee John;
Employee Sally;
John.SetAge(30);
John.SetYearsOfService(5);
John.SetSalary(50000);
Sally.SetAge(32);
Sally.SetYearsOfService(8);
Sally.SetSalary(40000);
cout << "John is " << John.GetAge << " years old and he has been with";
cout << " the firm for " << John.GetYearsOfService << " years\n";
cout << "John earns $" << John.GetSalary << " dollars a year.\n\n";
cout << "Sally is " << Sally.GetAge << "years old and she has been with";
cout << " the firm for " << Sally.GetYearsOfService << " years\n";
cout << "Sally earns $" << Sally.GetSalary << " dollars a year\n\n";
}
What's wrong?
Thanks!