home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16624 < prev    next >
Encoding:
Internet Message Format  |  1992-11-20  |  874 b 

  1. Path: sparky!uunet!cs.utexas.edu!usc!news.service.uci.edu!ucivax!news.claremont.edu!nntp-server.caltech.edu!ccsf.caltech.edu!iotov
  2. From: iotov@ccsf.caltech.edu (Mihail Iotov)
  3. Newsgroups: comp.lang.c++
  4. Subject: operator overloading
  5. Date: 20 Nov 1992 04:55:12 GMT
  6. Organization: CCSF Caltech, Pasadena, CA
  7. Lines: 23
  8. Distribution: world
  9. Message-ID: <1ehr3gINNopf@gap.caltech.edu>
  10. NNTP-Posting-Host: pollux.ccsf.caltech.edu
  11.  
  12.  
  13.  
  14. I am trying to overload some operators this way
  15.  
  16. set&   set::operator= (const set& s) ;
  17.  
  18. set  set::operator* (const set& s) 
  19. {
  20.   set   product ;
  21.   [do something]
  22.   return product ;        /* this line is 88 */
  23.  
  24. }
  25. and I get form g++ :
  26.  
  27. set.cxx: In method class set set::operator * (const class set &):
  28. set.cxx:88: warning: bitwise copy: `set' defines operator=()
  29.  
  30. Shouldn't the assignment method be called for the return operation ?
  31.  
  32.  
  33. Thanks, 
  34.     Mihail
  35.