Hey folks.
I am working on a project that adds additional information to previous projects. Basically, for ezch project i have added another header file with cpp file. For example, originally we just had an Employee.h and Employee.cpp file which contained a class for employees containing name, department, and SSN. Then we added more information etc etc.
I have got a problem with this line of code:
employee_list[numEmployees].setName(firstName, lastName);
This code calls this function within my Employee.cpp file (i included the Employee.h file in my main.cpp file where the function is called from - the header file includes arent the problem im 99% sure).
The called function looks like this:
void Employee::setName(const char * newFirst, const char * newLast)
{
setName(newFirst, newLast);
}
The setName function - obviously calls itself - but i want to be able to call a setName function within the Name.h/Name.cpp file - so how can i call a function in a different file ???
If i leave my code like this - as soon as it tries to call this function, my output says
...
...
...
Segmentation Fault
Then nothing else - it stops... and exits the program run.
If you need more information i will give it to you - but im not what more you may need. Here is the Name.h file to give you an idea of what is included in the Name.cpp file.
#ifndef NAME_H
#define NAME_H
//#include "Employee.h"
#include <fstream>
#include <istream>
#include <iomanip>
using namespace std;
class Name
{
private:
char firstName[11];
char lastName[16];
public:
Name();
void setName(const char *, const char *);
const char *getFirstName();
const char *getLastName();
const void print();
};
bool greaterThan(Name, Name);
#endif /* NAME_H */
I hope you guys could help. as i said , any questions, please ask and ill get back to you within a minute or 2.
Thanks