Hey Folks.
I am working on a project in which i have to use Classes and do multiple things with different sorts of data. The basic question i have though is this: what am i doing wrong here in terms of this class declaration etc... i have looked around on here, other websites about classes, used my text book and my lecture notes - but none really correlate with how i need to set up this class/constructor etc.
Please let me know how i could fix this to work it - and then i should be on a roll. Please include a brief description of where i could start if you dont wish to help me 100%!
Thanks - your help is always appreicated!
#include <iostream>
#include <fstream>
#include <ostream>
#include <string>
using namespace std;
class Employee
{
private:
//class variables
char last_name[39];
char first_name[39];
char ss_num[9];
double salary;
int years_employed;
public:
//class constructor
Employee()
{
last_name = "";
first_name = "";
ss_num = "";
salary = 0;
years_employed = 0;
}
//class methods
void print();
void setName(char [], char []);
void setSSN(char []);
void setSalary(double);
void setYearsEmployed(int);
int getLeaveTime();
} ;
int main()
{
Employee myName;
myName("Hogan", "Tony", "12300123", 55000, 10);
system("PAUSE");
return 0;
}
As you can see im trying to make a constructor with a last name, first name, SSN, salary and then years employed. I cant seem to get it working - im sure there is something obvious going on tho!
CHeers