Which compiler do you use?
And how is defined the Date class?
Because, if I try to compile the code below:
Code:
#include <fstream>
using std::ofstream;
struct Date {
int getMonth() const;
int getDay() const;
int getYear() const;
};
ofstream &operator <<(ofstream& stream, const Date& d)
{
stream << d.getMonth() << '|' //error found here
<< d.getDay() << '|'
<< d.getYear() << '|';
return stream;
}
I don't get any error when compiling. But, if I try to use MSVC6, it displays many errors but there are in the STL headers so it's not your fault anyway...