Date ClassCode:// Overide operator >> to read date std::istream& operator>>(std::istream& in, const Date& date) { in >> date.year; in >> date.month; in >> date.day; in >> date.hour; in >> date.minute; return in; } // ERROR: : error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'const int' (or there is no acceptable conversion)
???????Code:#ifndef DATE_H #define DATE_H #include <time.h> #include <iostream> class Date { public: Date(); void SetDate(tm curr_tm); static tm getCurrentTime(); int getDay(){return day;} int getMonth(){return month;} int getYear(){return year;} int getHour(){return hour;} int getMinute(){return minute;} tm getLocalDT(){return local_dt;} friend std::istream& operator>>(std::istream& in, const Date& date); friend std::ostream& operator<<(std::ostream& out, const Date& date); private: int day; int month; int year; int hour; int minute; tm local_dt; }; #endif;
All the members of Date are declared as int



LinkBack URL
About LinkBacks



