home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19791 < prev    next >
Encoding:
Internet Message Format  |  1993-01-23  |  911 b 

  1. Path: sparky!uunet!olivea!pagesat!netsys!agate!dog.ee.lbl.gov!news!marlin!atkins
  2. From: atkins@nosc.mil (Hugh T. Atkins)
  3. Newsgroups: comp.lang.c++
  4. Subject: help with pass-by-reference
  5. Keywords: c++,reference,pass
  6. Message-ID: <1993Jan22.231848.3690@nosc.mil>
  7. Date: 22 Jan 93 23:18:48 GMT
  8. Distribution: usa
  9. Organization: Naval Ocean Systems Center, San Diego, CA
  10. Lines: 23
  11.  
  12. Here's the setup, I have a class called Card and declare an array as
  13. follows
  14.  
  15.  
  16. Card myHand[5];  // this is an array of 5 playing cards
  17.  
  18. I want to write a function which tests for pairs of cards and I want
  19. to use pass-by-reference but I can't figure out how to declare the
  20. function prototype.
  21.  
  22. I'd like the function to return an int, something like this
  23.  
  24. int hasPair( const Card& );
  25.  
  26. then later I would use
  27.  
  28. if( hasPair( ?????? ) )
  29.   pairs++;
  30.  
  31. Can anyone help ? I realize this is sketchy and will provide more info
  32. if needed.
  33.  
  34. Thanks , Hugh
  35.