CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

overloaded operator friends



  I added a friend function to one of my classess and got a must be a 
member function error. the function was an overloaded = operator. 
when I changed it to a n overloaded << I didn't get the error. 
Anyone know why I'm getting this error?

kregg

class HUGE {

   //  yadayadayada

friend char* operator=( char*, const HUGE&  );  // gives error

  //  yadayadayada
};


 class HUGE {

   //  yadayadayada

friend char* operator<<( char*, const HUGE&  );  //  no error here

  //  yadayadayada

};


char * operator=(char *x, const HUGE &y )
{

  / /yadayadayada

}


char * operator<<(char *x, const HUGE &y )
{

  / /yadayadayada

}




W Komornicki's Home Page | Main Index | Thread Index