My compiler told me what was wrong, doesn't yours do the same?
Printable View
My compiler told me what was wrong, doesn't yours do the same?
His did if you've read the first post carefully. He did not understand. Got it.
elad: I did all that before I posted my thread. And with my original codes (all ofstream's, see posts above), this line gives the error:
And yup, I have succeded output member by member like thisCode:ofstream &operator<<(ofstream& stream, const Student& s) {
stream << s.getEnrollDate() << '|' // error
return stream;
}
But, I thought since I overloaded "<<" for Date object, then I could utilize my first method.Code:stream << s.EnrollDate.month << '|'
<< s.EnrollDate.day << '|'
<< s.EnrollDate.year << '|'
lyx: mine said
EDIT: I got the solution that I needed already, so thanks to all of you guys.Quote:
E:\jDocument\CSCI\231\no1\Student.cpp(354) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'const class Date' (or there is no acceptable conversion)
PS. I promise I will give credit for you on my codes:D
In fact, it isn't what I mean, my compiler told me that it was an ostream and not a ofstream, so I understood.