Listing 3

#include <stdio.h>
#include "obj.h"

#define SETCOLOR 0
#define GETCOLOR 1

extern CIRCLE_ACTIONS cact;

main()
   {
   int col;

   /* create CIRCLE c */
   CIRCLE c = { 14, &cact };

   /* use GETCOLOR message to get c's color */
   col = (*(c1.pcact->pactions[GETCOLOR]))(&c1);
   printf("c1 is color %d\n", col);


   /* use SETCOLOR message to set new color */
   (*(c1.pcact->pactions[SETCOLOR]))(&c1, 7);


   /* get the new color */
   col = (*(c1.pcact->pactions[GETCOLOR]))(&c1);
   printf("c1 is now color %d\n", col);
   }

/* End of File */