home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_09_12
/
9n12116a
< prev
next >
Wrap
Text File
|
1991-10-21
|
658b
|
29 lines
/* LISTING 7 - CIRCLE.C */
#include "obj.h"
/* get the color */
static int circle_getcolor(CIRCLE *pc)
{ return pc->color; }
/* set color */
static int circle_setcolor(CIRCLE *pc,
int color)
{ return (pc->color = color); }
/* create an "action package" for CIRCLEs */
static CIRCLE_ACTIONS cact =
{circle_setcolor, circle_getcolor};
/* and a "constructor" for a new circle */
constructor(CIRCLE *pc, int color)
{
pc->color = color;
/* constructor can access the private
action package! */
/* constructor hooks up actions */
pc->pcact = &cact;
}