Hello everyone, I wanted to know if there's anyone who can help me with this problem:
I'm writing a program in C + + in which I have defined some classes and I did the overloaded operators <<and>> for items related to these classes, but when I compile error: here you put a piece of code:
compile time to give me this error:Code:class data (public int G,public int M,public int A, public date (); void print (oStream & dest) {dest <<G <<"/"<< M <<"/"<< A; return; } void read (IStream & sorg) (int day, month, year; char sep ='/'; sorg>> day>> sep>> months>> sep>> year; G = day; M = month; A = year; return; ) ) class Person: public data (public: string name; SURNAME string; birth date; ADDRESS string; MAIL string; person (); void print (oStream & dest) (dest <<NAME <<endl <<NAME <<endl; dest <<BIRTH; dest <<endl <<ADDRESS <<endl <<MAIL <<endl <<endl; return; ) void read (IStream & sorg) (string name, surname, address, email; birth date; sorg>> name>> surname; sorg>> birth; sorg>> address>> email; NAME = name; SURNAME = surname; BIRTH = birth; ADDRESS = address; MAIL = email; return; ) ) / / other classes and various robe ... / / then out of the definition of any class and before opening the main, I wrote: oStream & operator <<(oStream & dest, const data & x) (x.stampa (dest); return dest; ) IStream & operator>> (IStream & sorg, data & x) (x.leggi (sorg); sorg return; ) oStream & operator <<(oStream & dest, const person & x) (x.stampa (dest); return dest; ) IStream & operator>> (IStream & sorg, person & x) (x.leggi (sorg); sorg return; )
no match for 'operator <<' in 'dest <<((person) * this) -> person:: BIRTH'
Why? How do I solve this problem?
Thanks in advance to those who answered!


Reply With Quote

Bookmarks