Hi, I'm working on the following program and keep getting error message on the relational operator ==, <, << and >>. Error6 error C2511: 'bool TimeType::operator <(const TimeType &)' : overloaded member function not found in 'TimeType ', and on the other ones as well when I try to overload them.
1). Write the specification of a class named TimeType with the following members:
The relational operators <and ==
The stream insertion << to write data members of a TimeType object to an output stream.
The stream insertion >> to read data members of a TimeType object to an output stream.
2). Write the implementation of the == operator(return true if this time matches another time object passed as a parameter, return false otherwise).
Write the implementation of the << operator(writes the time in the format HOURS:MINUTES:SECONDS to an output stream).
Here is my code:
@jonatashille, the >> and << operators should return istream& and ostream&, respectively. And, louflow, in your == operator you check if(time1==time1.time), which is full of errors. First of all you didn't implement the "time" element of you class, and second of all, you are checking if the object is equal to it's element, which is always false. You need if (time==time1.time)