home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / os2tk21j / c / samples / animals / main.a__ / main.c
Encoding:
C/C++ Source or Header  |  1993-03-12  |  1.7 KB  |  72 lines

  1. #ifndef lint
  2. static char *sccsid = "@(#)main.c 1.4 2/3/92 20:40:11 [2/3/92] (c)IBM Corp. 1992";
  3. #endif
  4.  
  5. /*
  6.  * Copyright (c) International Business Machines Corporation
  7.  *         1991, 1992
  8.  */
  9.  
  10. #include "animal.h"
  11. #include "dog.h"
  12. #include "ldog.h"
  13. #include "bdog.h"
  14.  
  15. void main(int argc)
  16. {
  17.     Animal *myAnimal;
  18.     Dog *myDog;
  19.     LittleDog *myLittleDog;
  20.     BigDog *myBigDog;
  21.  
  22.     /*
  23.      * Create classes.
  24.      */
  25.     AnimalNewClass(Animal_MajorVersion, Animal_MinorVersion);
  26.     DogNewClass(Dog_MajorVersion, Dog_MinorVersion);
  27.     LittleDogNewClass(LittleDog_MajorVersion, LittleDog_MinorVersion);
  28.     BigDogNewClass(BigDog_MajorVersion, BigDog_MinorVersion);
  29.  
  30.     SOM_TraceLevel = (argc > 1 ? 1 : 0);
  31.  
  32.     /*
  33.      * Create objects using constructors
  34.      */
  35.     myAnimal = _newAnimal(_Animal, "Roar!!!");
  36.     myDog = _newDog(_Dog, "Grrr", "Retriever", "Yellow");
  37.     myLittleDog = _newDog(_LittleDog, "unknown noise",
  38.               "French Poodle", "Black");
  39.     myBigDog = _newDog(_BigDog, "unknown noise",
  40.                "German Shepherd", "Brown");
  41.  
  42.     /*
  43.      * Display objects.
  44.      */
  45.     somPrintf("=====================\n");
  46.     somPrintf("myAnimal:\n");
  47.     _display(myAnimal);
  48.  
  49.     somPrintf("=====================\n");
  50.     somPrintf("myDog:\n");
  51.     _display(myDog);
  52.  
  53.     somPrintf("=====================\n");
  54.     somPrintf("myLittleDog:\n");
  55.     _display(myLittleDog);
  56.  
  57.     somPrintf("=====================\n");
  58.     somPrintf("myBigDog:\n");
  59.     _display(myBigDog);
  60.  
  61.     /*
  62.      * Free objects.
  63.      */
  64.     somPrintf("\n");
  65.     _somFree(myAnimal);
  66.     _somFree(myDog);
  67.     _somFree(myLittleDog);
  68.     _somFree(myBigDog);
  69.  
  70.     exit(0);
  71. }
  72.