home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / std / cplus / 903 < prev    next >
Encoding:
Internet Message Format  |  1992-07-21  |  1.4 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!engr.uark.edu!mbox.ualr.edu!acs.harding.edu!CHOATE
  2. Newsgroups: comp.std.c++
  3. Subject: How do I... (regarding overloading)
  4. Message-ID: <1992Jul21.144856.583@ualr.edu>
  5. From: choate@acs.harding.edu (Brad S. Choate)
  6. Date: 21 Jul 92 14:48:55 -0500
  7. Reply-To: choate@acs.harding.edu
  8. Organization: Harding University
  9. Nntp-Posting-Host: acs.harding.edu
  10. Lines: 25
  11.  
  12. Ok... I'm new at this business, so this should be easy for some of the experts
  13. out there.
  14.  
  15. I know about operator overloading and I can implement it to some degree without
  16. consulting the manuals too much, but I'm stuck on this one:
  17.  
  18.     a[1]=x;
  19.  
  20. Ok.  "a" is an object that I have created and I've overloaded the [] operator
  21. to allow me to return a value at position "1" (in this case) from my object.
  22. However, in this case, I'm not needing output, I'm trying to _assign_ a value
  23. to that position.  I know how to overload the "=" operator, but _how_ do you
  24. do _both_ operators at the same time?
  25.  
  26. Perplexed++
  27. (any ideas?)
  28. e-mail me if you have an answer!  This one's been bugging me.
  29.  - Brad
  30. --
  31.  Disclaimer: "I really don't care."
  32.  
  33.  |) |) /\ |\  | Brad S. Choate                      | 1314 E. Market, Apt. 6
  34.  |) |\ || |/  |                                     | Searcy, AR  72143
  35.  --------_--  | choate@acs.harding.edu              | (501) 279-2584
  36.   <||()/\|[   | V.P., Software Extensions, Inc.
  37.