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

  1. Path: sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!ariel.lerc.nasa.gov!smneyln
  2. From: smneyln@ariel.lerc.nasa.gov
  3. Newsgroups: comp.lang.c++
  4. Date: 17 Jul 92 22:00 MDT
  5. Subject: Is this call necessary?...
  6. Sender: Notesfile to Usenet Gateway <notes@glas.apc.org>
  7. Message-ID: <17JUL199213004515@ariel.lerc.nas>
  8. Nf-ID: #N:17JUL199213004515@ariel.lerc.nas:1576324756:001:881
  9. Nf-From: ariel.lerc.nasa.gov!smneyln    Jul 17 22:00:00 1992
  10. Lines: 32
  11.  
  12.  
  13. I have classes defined as such:
  14. class A {
  15. ..
  16. };
  17.  
  18. class B : public A {
  19. private:
  20.     a *a;
  21. ..
  22. };
  23.  
  24. Now, at some point in the program, I need to modify some of the values of
  25. the A member refenenced by B.  To do so, I have the following private
  26. function in B:
  27.  
  28. A GetAMember() {return *a;};
  29.  
  30. My question is: If then have: A amember = bmember.GetAMember, can I
  31. assume that changes made in amember will be also done in a->a? Or do i need
  32. a put function as void PutAMember(A amember) {a = &amember); ?
  33.  
  34. Thanks...
  35.  
  36.  
  37. Mike Neylon          aka Masem the Great and Almighty Thermo GOD
  38.   // Only the | Univ. of Toledo - Chemical Engineering - Senior
  39. \X/   AMIGA!  |   NASA Lewis Research Center - Summer Intern
  40. \_____________|_____smneyln@ariel.lerc.nasa.gov________________/
  41.        -+ How do YOU spell 'potato'?  How about 'lousy'? +- 
  42.       "Me and Spike are big Malcolm 10 supporters."-J.S.,PLCL
  43.  
  44.