I am having problems declaring a class function from the header file, am not sure how it should be formatted in the header. The purpose of this is to save class object data into a file, to be able to read back in later.
employee.h
void writedata(ofstream);
employee.cpp
void Employee::writedata(ofstream& employeewrite)
{
}
Employeewrite is the ostream object I declared in main
main.cpp
ofstream employeewrite("c:\\test\test.txt");
Thanks for any help.
You’re declaring
writedatato take aofstreamin your header, but defining it to take anofstream&(a reference to anofstream) in the source file. Make them match up.