c++ - Reading and writing binary files with objects having vector data members -
i trying write binary file records of type student vector data members. while compiling, gives binding error.
class student { private: string sname; string idno; int books_issued_to_stu; vector<int> bid_nos; vector<string> bname; vector<time_t> bissue_date, breturn_date; double fine; public: friend ostream& operator<<(ostream &os, const student &s) { os<<s.idno<<'\n'; os<<s.sname<<'\n'; os<<s.books_issued_to_stu<<'\n'; os<<s.bid_nos<<'\n'; os<<s.bname<<'\n'; os<<s.bissue_date<<'\n'; os<<s.breturn_date<<'\n'; os<<s.fine<<'\n'; return os; } friend istream& operator>>(istream &is, student &s) { is>>s.idno>>s.sname>>s.books_issued_to_stu>>s.bid_nos>>s.bname; is>>s.bissue_date>>s.breturn_date>>s.fine; return is; } };
Comments
Post a Comment