home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / os2tk20 / c / samples / animals / animal.cs_ / ANIMAL.CSC
Encoding:
Text File  |  1992-07-15  |  1.5 KB  |  62 lines

  1. #   @(#)animal.csc 1.3 2/3/92 20:39:53 [2/3/92] (c)IBM Corp. 1992
  2.  
  3. -- Copyright (c) International Business Machines Corporation
  4. --         1991, 1992
  5.  
  6. include "animeta.sc"
  7. include <somobj.sc>
  8.  
  9. class: Animal,
  10.   local;
  11.  
  12. metaclass: AnimalFactory;
  13.  
  14. parent: SOMObject;
  15.  
  16. data:
  17.   char *sound;
  18.   int  nsound;
  19.  
  20. methods:
  21.  
  22. group: SetMethods;
  23.  
  24.    void setSound(char *mySound);
  25. -- Tell animal what kind of a sound it makes.
  26.  
  27. group: GetMethods;
  28.  
  29.    char *getGenus();
  30. -- Returns the genus of animal.
  31. -- This method should be overridden by derived classes.
  32. -- The default version here just gives "unknown' as the genus.
  33.  
  34.    char *getSpecies();
  35. -- Returns the species of animal.
  36. -- This method should be overridden by derived classes.
  37. -- The default version here just gives "unknown' as the species.
  38.  
  39. group: DisplayMethods;
  40.  
  41.    void talk();
  42. -- Ask the animal to talk.  Normally this just prints out the
  43. -- string set by setSound(), but it can be overriden to do something
  44. -- else.
  45.  
  46.    void display();
  47. -- Displays an animal.    Derived classes should override this to
  48. -- display new derived information, and then call their parent
  49. -- version. Note: this method makes use of talk() to describe what
  50. -- the animal says.
  51.  
  52. group: SystemMethodOverrides;
  53.  
  54.    override somInit;
  55. -- This method will be invoked when a new animal is created.
  56.  
  57.    override somUninit;
  58. -- This is invoked when an animal object is freed.
  59.  
  60.    override somDumpSelfInt;
  61. -- Invoked when an animal is dumped.
  62.