home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / SAMPLES / ICLCC / TOYWORD.H < prev    next >
C/C++ Source or Header  |  1993-05-07  |  2KB  |  45 lines

  1. /******************************************************************************/
  2. /*                                                                            */
  3. /* COPYRIGHT:                                                                 */
  4. /* ----------                                                                 */
  5. /* Copyright (C) International Business Machines Corp., 1991,1992.            */
  6. /*                                                                            */
  7. /* DISCLAIMER OF WARRANTIES:                                                  */
  8. /* -------------------------                                                  */
  9. /* The following [enclosed] code is sample code created by IBM                */
  10. /* Corporation.  This sample code is not part of any standard IBM product     */
  11. /* and is provided to you solely for the purpose of assisting you in the      */
  12. /* development of your applications.  The code is provided "AS IS",           */
  13. /* without warranty of any kind.  IBM shall not be liable for any damages     */
  14. /* arising out of your use of the sample code, even if they have been         */
  15. /* advised of the possibility of such damages.                                */
  16. /*                                                                            */
  17. /******************************************************************************/
  18. /*-------------------------------------------------------------*\
  19. |  toyword.h  -  Class Word for use with coding examples.       |
  20. \*-------------------------------------------------------------*/
  21.  
  22. #include "toystrng.h"
  23.  
  24. class Word : public ToyString  {
  25.  
  26.   public:
  27.  
  28.     Word(char* pc) : ToyString(pc) {}
  29.  
  30.        /* Equality op is not required for the collections *\
  31.        |  that use this Word class.                        |
  32.        |  Inequality is not required for the collections   |
  33.        |  either but needed by our example code to         |
  34.        \* iterate until we hit the Word we searched for   */
  35.     int  operator != (char* anOther) const {
  36.                   return (!operator==(anOther));
  37.     }
  38.  
  39. };
  40.        // Key addess.  The length of the word is the key.
  41. inline  int const& key (Word const& aWord) {
  42.    return aWord.length();
  43. }
  44.  
  45.