home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / examples.pak / DEF2.CPP < prev    next >
Text File  |  1997-07-23  |  634b  |  31 lines

  1. // Borland C++ - (C) Copyright 1991, 1992 by Borland International
  2.  
  3. // def.cpp:    Implementation of the Definition class
  4.  
  5. #include <string.h>
  6. #include "def2.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;
  30. }
  31.