home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / TCPP30-3.ZIP / EXAMPLES.ZIP / DEF.CPP < prev    next >
C/C++ Source or Header  |  1992-02-18  |  687b  |  31 lines

  1. // Borland C++ - (C) Copyright 1991 by Borland International
  2.  
  3. // def.cpp:   Implementation of the Definition class
  4. // from Hands-on C++
  5. #include <string.h>
  6. #include "def.h"
  7.  
  8. void Definition::put_word(char *s)
  9. {
  10.    word = new char[strlen(s)+1];
  11.    strcpy(word,s);
  12.    nmeanings = 0;
  13. }
  14.  
  15. void Definition::add_meaning(char *s)
  16. {
  17.    if (nmeanings < Maxmeans)
  18.    {
  19.       meanings[nmeanings] = new char[strlen(s)+1];
  20.       strcpy(meanings[nmeanings++],s);
  21.    }
  22. }
  23.  
  24. char * Definition::get_meaning(int level, char *s)
  25. {
  26.    if (0 <= level && level < nmeanings)
  27.       return strcpy(s,meanings[level]);
  28.    else
  29.       return 0;                                // line 27
  30. }
  31.