home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11660 < prev    next >
Encoding:
Text File  |  1992-07-28  |  1.5 KB  |  41 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!eagle!ariel.lerc.nasa.gov!smneyln
  3. From: smneyln@ariel.lerc.nasa.gov (Michael Neylon)
  4. Subject: HELP with overloading binary operator...
  5. Message-ID: <28JUL199210114546@ariel.lerc.nasa.gov>
  6. News-Software: VAX/VMS VNEWS 1.41    
  7. Sender: news@eagle.lerc.nasa.gov
  8. Organization: NASA Lewis Research Center
  9. Date: 28 Jul 1992 10:11 EST  
  10. Lines: 29
  11.  
  12. I have the following class...
  13.  
  14. classs ARRAYBASE {
  15. private: float matrix[MAXSIZE][MAXSIZE];
  16. public: int xsize, ysize;
  17.     ARRAYBASE(int x, int y) {xsize=x+1;ysize=y+!;};
  18. // put + get handlers
  19. // overloaded operator= which is fine
  20. // Inverse() function, taken from _Num. Rec. in C_
  21.     ARRAYBASE ARRAYBASE::operator*(ARRAYBASE array1, ARRAYBASE array2)
  22.     {
  23.         //fill the array using matrix multiplication
  24.         //fill in matrix[][] and xsize, and ysize vars
  25.         return *this;
  26.     };
  27. };
  28.  
  29. (obviously, this defines arrays with a base as 1 (a[1..6][1..6]))
  30. However, when i compile, i get...
  31. ARRAYBASE::operator*() must take only 0 or 1 arguments
  32. huh? this is the same format that I can find in several C++ books for
  33. overloaded binary operators.  Whats wrong?!
  34.  
  35. Mike Neylon          aka Masem the Great and Almighty Thermo GOD
  36.   // Only the | Univ. of Toledo - Chemical Engineering - Senior
  37. \X/   AMIGA!  |   NASA Lewis Research Center - Summer Intern
  38. \_____________|_____smneyln@ariel.lerc.nasa.gov________________/
  39.        -+ How do YOU spell 'potato'?  How about 'lousy'? +- 
  40.       "Me and Spike are big Malcolm 10 supporters."-J.S.,PLCL
  41.