0

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.

josh conners
  • 25
  • 2
  • 4

1 Answers1

1

You're declaring writedata to take a ofstream in your header, but defining it to take an ofstream& (a reference to an ofstream) in the source file. Make them match up.

sheu
  • 5,653
  • 17
  • 32