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 >
Wrap
Text File
|
1991-10-21
|
598b
|
32 lines
/* LISTING 3 - OBJ.C */
#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);
}