having troubles with simple class(a simple example blows up) heh
hello everyone....
i am having some problems making a simple class and setting its data members using accessor functions, i get tons of errors, whats wrong? i made all the methods inline, thats why i don't have like Employee::GetAge() {}
here is the code for the .cpp file:
Code:
#include "Employee.hpp"
int main() {
Employee Cory;
Cory.SetAge(15);
Cory.SetSalary(100000);
Cory.SetyearsOfservice(4);
cout << Cory.GetAge << endl;
cout << Cory.GetSalary << endl;
cout << Cory.GetyearsOfService << endl;
here is the code for the .hpp file:
Code:
#include <iostream.h>
class Employee
{
public:
void SetAge(int EAge) {age = EAge;} //inline
void SetyearsOfService(int yOf) {yearsOfService = yOf;} //inline
void SetSalary(int Money) {Salary = Money;} //inline
int GetAge() {return age;} //inline
int GetyearsOfservice() {return yearsOfservice;} //inline
int GetSalary() {return Salary;} //inline
private:
int age;
int yearsOfservice;
int Salary;
};