nclass string {
n public:
n friend istream & operator >>
(istream &, string &);
n friend ostream & operator <<
(ostream &, const string&);
n •••
n private:
n char * str;
n int len;
n};
n
nistream & operator
>> (istream &in, string &s) {
n char temp[100];
n in >>temp; //or, should this could be in.get?!
n s.len = strlen(temp);
n s.str = new char[s.len+1];
n strcpy(s.str, temp);
n return in;
n}
n
nostream & operator
<< (ostream &o, const string& s){
n o << s.str; //notice no additional whitespace
sent....
n return o;