home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 1483 < prev    next >
Encoding:
Text File  |  1996-08-05  |  846 b   |  35 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: news.interlog.com!rose!awhite
  3. From: awhite@user.rose.com (A White)
  4. Subject: overloading operators...
  5. Sender: news@rose.com (news)
  6. Organization: Rose Media Incorpoarted, Ontario, Canada
  7. Message-ID: <DLFwoG.5xJ@rose.com>
  8. Date: Fri, 19 Jan 1996 18:00:15 GMT
  9.  
  10. As a working example, I'm creating a variable class:
  11.     class {
  12.         var_t  _type;
  13.         union {
  14.             ULONG _long;
  15.             ...
  16.         }
  17.         ...
  18.     } variable;
  19.  
  20. I want to overload the various operators (=, +, -, ...) so that :
  21.     variable A = 10;
  22.     variable B = "!@#";
  23.     variable C = 23.3;
  24.  
  25. all construct as expected.
  26.  
  27. Subsequently, I'd want to overload + so that I can add directly into the
  28. instance (addition, concatenation, etc).
  29.  
  30. In both  cases, my compiler (SAS/C++, Amiga) complains about second reference
  31. to overloaded operator.
  32.  
  33. Is this a standard limitation of C++?
  34.  
  35.