home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_12 / 9n12111b < prev    next >
Text File  |  1991-10-21  |  598b  |  32 lines

  1. /* LISTING 3 - OBJ.C */
  2.  
  3. #include <stdio.h>
  4. #include "obj.h"
  5.  
  6. #define SETCOLOR 0
  7. #define GETCOLOR 1
  8.  
  9. extern CIRCLE_ACTIONS cact;
  10.  
  11. main()
  12.    {
  13.    int col;
  14.    
  15.    /* create CIRCLE c  */
  16.    CIRCLE c = { 14, &cact };  
  17.  
  18.    /* use GETCOLOR message to get c's color */
  19.    col = (*(c1.pcact->pactions[GETCOLOR]))(&c1);
  20.    printf("c1 is color %d\n", col);
  21.  
  22.  
  23.    /* use SETCOLOR message to set new color */
  24.    (*(c1.pcact->pactions[SETCOLOR]))(&c1, 7);
  25.  
  26.  
  27.    /* get the new color */
  28.    col = (*(c1.pcact->pactions[GETCOLOR]))(&c1);
  29.    printf("c1 is now color %d\n", col);
  30.    }
  31.  
  32.